Hi all,

to add support of fetching a custom_field by a known ID of clonable page, modify Line ~216 in /couch/tags.php by adding 3 small pieces to function get_custom_field

1.
Code: Select all
elseif( $id ){
   $sql .= "p.id = '".$DB->sanitize( $id )."' and ";
}

place the above code right after
if( $page ){
$sql .= "p.page_name = '".$DB->sanitize( $page )."' and ";
}

So the whole final piece in code looks like this
Code: Select all

if( $page ){
   $sql .= "p.page_name = '".$DB->sanitize( $page )."' and ";
}
elseif( $id ){
   $sql .= "p.id = '".$DB->sanitize( $id )."' and ";
}
else{
   $sql .= "p.is_master = '1' and "; //if no page specified, use the default page
}


--
2. add 'id'=>'' to
Code: Select all
extract( $FUNCS->get_named_vars(
         array( 'var'=>'',
               'masterpage'=>'',
               'page'=>'',
               'id'=>''
              ),
         $params)
      );

--
3. Modify commentary to
// Used to get a custom field by specifying the template name, page name and page id.


I guess this little mod should be useful for power users or in places, where id's of pages are fetched with <cms:pages ids_only='1' >.

P.S. This post is a honored by celebration of my 777th message on forum. :)

P.P.S The reason I don't make this as `overriding` tag in kfunctions.php - is my hope to see this in native codebase.