Changing the createdBy pull down to show the value of a first name and last name field from a member's account record

7 posts by 2 authors in: Forums > CMS Builder
Last Post: December 29, 2015   (RSS)

By ross - December 28, 2015

Hi Jerry

This will be a thread for advanced users only.  

What you are looking for is the "ajaxGetUsersAsPulldown()" function you found in common.php.  You'll see the SQL that is used to grab the list of users.  

$query = "SELECT u.num, u.username              FROM {$TABLE_PREFIX}accounts u              JOIN {$TABLE_PREFIX}_accesslist a ON u.num = a.userNum             WHERE a.accessLevel > 1 AND a.tableName IN ('all','$tableName')             ORDER BY username";

The first field in the SELECT is what gets used as the value stored in your database and should always be left as "a.num".

The section field listed is what is displayed in the drop down. You could do a CONCAT(a.firstname,a.lastname) or something like that. 

Keep in mind that we don't support changes to the library files like this so any further discussion on this can be continued through consulting@interactivetools.com. You'll also find that this change will be undone when you upgrade next.

Thanks!

$query = "SELECT u.num, u.username              FROM {$TABLE_PREFIX}accounts u              JOIN {$TABLE_PREFIX}_accesslist a ON u.num = a.userNum             WHERE a.accessLevel > 1 AND a.tableName IN ('all','$tableName')             ORDER BY username";

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By gkornbluth - December 28, 2015 - edited: December 28, 2015

Thanks Ross,

This will help a great deal.

Any possibility that the change could become a plugin or a core program change?

Best,

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

By ross - December 28, 2015

Hi Jerry.

I've emailed Dave and we'll see what we can do.  

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By gkornbluth - December 29, 2015

Hi Ross,

If I understood you correctly, changing the line

  $query = "SELECT u.num, u.username

to

 $query = "SELECT u.num, u.last_name

should display the value of the 'last_name' field in the drop down, but it displays record numbers instead,

The closest I can come is to also change:

$userNames   = array_pluck($users, 'username');

to

$userNames   = array_pluck($users, 'last_name');

in the get options values section, but that only displays one 'last_name' value and some blank line choices.

Any thoughts?

Thanks,

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

By ross - December 29, 2015

Hi Jerry

I think I've jumped us down a rabbit hole here. 

Making this kind of change to the core library files is very advanced and not something we support.  We'll need to continue this conversation via consulting.

Could you email me via consulting@interactivetools.com?

Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By gkornbluth - December 29, 2015

sure

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