Jump to content

Recommended Posts

Posted

How can I display the real user's name instead of the one used in the login?

For example, let's say my user login is "admin" or "hafa"

But I want to display my real name on the site, like so:

"Posted by Rafael"

So the question is how to get real names, instead of the users login.

Posted

Ha, found out how a couple of minutes later after posting :P

Thanks for the link mr-fan.

So if I create a new field "real name" for the users, how do I display it in the frontend?

Posted

The "user" is basically just another Page. So you can add a field to the user template and access it from the API.

  1. Create a field for your name, e.g. fullname. Or use an existing one
  2. Go to Site > Setup > Templates and then click on "Filter". Enable that system-templates are shown
  3. Edit the "user" template and add your fullname field. Save
  4. Go to your users profile and enter your name
  5. On the front end side, access the field as usual with $user->fullname

EDIT:

Output the "fullname" field of the user, that last modified the page: $page->modifiedUser->fullname.

  • Like 5
Posted

The "user" is basically just another Page. So you can add a field to the user template and access it from the API.

  1. Create a field for your name, e.g. fullname. Or use an existing one
  2. Go to Site > Setup > Templates and then click on "Filter". Enable that system-templates are shown
  3. Edit the "user" template and add your fullname field. Save
  4. Go to your users profile and enter your name
  5. On the front end side, access the field as usual with $user->fullname

EDIT:

Output the "fullname" field of the user, that last modified the page: $page->modifiedUser->fullname.

Thank you Philipp =) I hadn't noticed the system-templates.

What the "modifiedUser" in the code means?

Posted

Just a small comment (addition to Philipp's suggestion): In some of my PW sites, I use the existing "title" field to hold the user's full/display name.

  • Like 2
  • 9 months later...
Posted

So how do I get the "fullname" field to appear in the profile edit view? Even my superuser can't see it.

Another strange thing I noticed: in preparation for CSV import of users, I added the title field to the user template (in addition to fullname). If I input a fullname and a title for my superuser + tick a checkbox to add a role, none of the values get saved!

Posted

You need to edit the ProcessProfile module. There you can chose out of the template's fields which one are visible.

Wow, I never would have thought of that.

The unrelated problem of not being able to assign my superuser to a new role remains (the same behavior is in another site without any user template modifications). Yet in the other site my superuser also has the "blog-author" role.. Well, I can live with it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...