Re: [Perchpole] Quickie Request: createdByUserNum
Hi Perch,
I didn't realize we were missing that feature! I've added it to our development branch which should make it into the next release of CMS Builder, but if you want to patch it in yourself in the meantime, here are some instructions:
Open cmsAdmin/lib/viewer_function.php in an editor. Search for the getCategories function:
function getCategories($options) {
A few lines down, you'll find a list of valid options. Add the code in red (including the comma):
$validOptions = array('tableName', 'useSeoUrls', 'debugSql',
'selectedCategoryNum','categoryFormat', 'loadUploads','defaultCategory', 'rootCategoryNum','ulAttributes','ulAttributesCallback','liAttributesCallback','loadCreatedBy');
About 30 lines below that, there's a call to getRecords. loadCreatedBy is hardcoded to false. Change that (in red) to:
'loadCreatedBy' => @$options['loadCreatedBy'], // optional, defaults to yes, adds createdBy. fields for created user
Finally, you'll need to add 'loadCreatedBy' => true to your own getCategories call in your front end PHP page:
list($categoriesRecords, $selectedCategory) = getCategories(array(
'tableName' => 'example',
'loadCreatedBy' => true,
));
I hope this helps! Please let me know if you have any questions.
All the best,
Chris