Quickie Request: createdByUserNum

7 posts by 4 authors in: Forums > CMS Builder
Last Post: October 28, 2010   (RSS)

Hello, All -

I have a quickie request for a future update, if poss...

Can we have a pseudo field for the createdByUserNum field, please?

I'm thinking of something similar to the createdBy.fullname combo.

This would allow me to post the actual name of the person who created the category in just the same way as it is currently possible to do for a normal page.

Just a thought.

:0)

Perch

Re: [Perchpole] Quickie Request: createdByUserNum

This should do the trick
"createdBy.fullname"

Re: [Perchpole] Quickie Request: createdByUserNum

By Chris - October 27, 2010

Hi Perch,

I'm confused: does $category['createdBy.fullname'] not work for you?
All the best,
Chris

Re: [Perchpole] Quickie Request: createdByUserNum

By Jason - October 28, 2010

Hi Perch,

Could you attach the .php file you're working with so we could take a look? We could then give some more specific suggestions.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Quickie Request: createdByUserNum

Hi, Jason -

Thanks for the offer of help. Unfortunately there isn't really anything to show you.

I'm working with a category menu using the $selectedCategory['xyz'] functions.

I can call the name: $selectedCategory['name']

...the number: $selectedCategory['num']

...even the number of the person who created the category item: $selectedCategory['createdByUserNum']

...but there is no way of showing that person's actual name.

That's all I want to do! Hence the suggestion of a new psuedo field for the createdByUserNum entry.

Hope that helps.

:0)

Perch

Re: [Perchpole] Quickie Request: createdByUserNum

By Chris - October 28, 2010 - edited: October 28, 2010

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