adding username to each section

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

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

Hi Ross

To make things simple to explain i used "Username" from the "User Accounts" but we actually have a "Team name"

This is not for the front end of the site, i know how to do that, but we are using the back end as a register to a rally.

A Team logs in and registers themselves.They are able to come in and edit there team info at any time.

In the screen shot you will see each section in the menu.

when the admin overviews each listing fin each section the amin can see which team it relates to. (see screenshot)

We want to see "Team Name" to appear in the forms of each section, but i did not want the team to have to repeat their team name in each section when completing.

hope this makes sense, i am terrible at explaining things lol

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/