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 gkornbluth - December 23, 2015 - edited: December 23, 2015

Hi All,

My client has to regularly create new records for members, and then change the createdBy pull down on that record so that the members have “author” access to their newly created record.

I don’t use the fullname field, and the username field is proving to be a confusing jumble of entries, so I’ve been thinking about how I could change the createdBy pull down to show the value of a first name and last name field in the member’s account record.

I found references to a showCreatedByUserPulldown function, and an ajaxGetUsersAsPulldown in the following 4 core files,

lib/menus/default/edit_functions.php
lib/menus/default/edit_functions.js
lib/menus/default/actionHandler.php
lib/menus/default/common.php

but don’t feel capable of mucking about there without some expert guidance.

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 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 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