adding username to each section

8 posts by 2 authors in: Forums > CMS Builder
Last Post: November 3, 2016   (RSS)

By loccom - November 2, 2016

Hi

Wonder if you guys can help

I have 5 sections in the admin area, each section has to be completed by the user in the back end. However, I would like the username from the "User Accounts" section to be shared across all 5 sections listing form, so when they submit each section their username is listed with each form. I tried to do this with related records, not much luck as lack of knoweldge, also tried it with the list options feature, is sort of worked but they had to choose from a list. 

Quick Example

Section 1
Username (pre-filled using data from User Accounts)
Felid 1
Feild2
Field3

Section 2
Username (pre-filled using data from User Accounts)
Felid 1
Feild2
Field3

Hope this works

By ross - November 2, 2016

Hi there.

Thanks for posting.

I'd like to start here with going over why you'd like to have the username appear in each record like that.

The system already tracks what user creates each record in the "createdByUserNum" field and will display the username at the top of the page like this:

Created Nov 2nd, 2016 - 09:29:32 PM (by "username") 

If you are doing this so you can display the username on the front end of your site, you can use this:

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

You can actually access any field in the user account table through this means:

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

Does that make sense?

Let me know any questions.

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 ross - November 3, 2016

Hi locom

What I get from this is that you have a field in your "accounts" section called "Team Name".

Each of the 4 sections you showed me in your screenshot also have a "Team Name" field.

When a member clicks to create a record in any of the 4 sections, you want the "Team Name" field to auto populate with the value set in your "accounts" section.

Am I on the right track with this?

If so, what you can do is go into each of your 4 sections and modify the "Team Name" field.  You can set the "Default Value" to:

<?php echo $CURRENT_USER['team_name']; ?>

Note

This is a very basic implementation.  If a member changes their "Team Name" in the "accounts" section, the system will not update all the records in your 4 other sections; that will need to be a manual change.

If that's an issue, we can build a custom plugin to handle auto updating existing records.

Let me know what you think.

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 loccom - November 3, 2016

That is perfect.. and it looked so easy too.

The user will not have access the team name as it's vital it stays untouched.

thanks so much

By ross - November 3, 2016

Great! Glad that worked :).

Keep us up to date with how you are making out.

-----------------------------------------------------------
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 loccom - November 3, 2016

First one fixed it a treat

Just out of curiosity as it gave me an idea, is is possible to do the same from one of those sections to another? (not from user accounts)

so out of the 4 sections i can take a field from section 2 and add to section 4

<?php echo $CURRENT_USER['team_name']; ?>

I presume i change the CURRENT_USER part of the code?

is there a guide on this as well?

By ross - November 3, 2016

Hi loccom

There isn't an easy way to get a value from a field in section 1 to auto-populate a field in section 2 when you create a new record.

We can build a custom plugin through consulting, though. If you'd like to discuss the options, you can email as via consulting@interactivetools.com.

Let me know any other questions.

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/