Adding User Value to field in back end

5 posts by 3 authors in: Forums > CMS Builder
Last Post: June 1, 2012   (RSS)

By pgplast - May 30, 2012

I am interested to know if there is a way to add a logged in user value into a field placed in a CMS builder table from within the backend. Rather than work with an outside form, I would like to allow a user "author" access to a blog posting table and automatically place the user's name or num into a field hidden to all but admins. It does not appear that one can place $CURRENT_USER['num'] or <?php echo $CURRENT_USER['num'] ?> into a text field as a default value. I tried to make a field using the relatedRecords choice, using the accounts table and where clause:

num='<?php echo mysql_escape(@$CURRENT_USER['num']) ?>'

This does generate a field of values from the accounts table that the admin can see, but I don't know how one would pluck out a name or num value for use in a viewer for those records. For example, if the field is named "bloggers," the use of echo $record['bloggers.fullname'] just throws an error.

Any suggestions>

Thanks.

Re: [pgplast] Adding User Value to field in back end

By Jason - May 31, 2012

Hi,

When a record is created, the user's num value gets stored in the createdByUserNum field of the record just created. When the record is retrieved on the front end, you can access user information through the createdBy. set of pseudo fields.

for example, to get their full name, you would output this:

<?php echo $record['createdBy.fullname'];?>

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: [pgplast] Adding User Value to field in back end

By Jason - June 1, 2012

Hi,

We are working on a knowledge base of articles:
http://www.interactivetools.com/kb/


The Forum is definitely your best resource for information as we have a large and helpful community here.

Please let us know if we can help with anything else.

Thanks
---------------------------------------------------
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: [pgplast] Adding User Value to field in back end

By gkornbluth - June 1, 2012

Hi pgplast,

You might also find some of the information and recipes in my CMSB Cookbook helpful http://www.thecmsbcookbook.com

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php