hafa Posted October 13, 2014 Share Posted October 13, 2014 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. Link to comment Share on other sites More sharing options...
mr-fan Posted October 13, 2014 Share Posted October 13, 2014 where do you wanna show them? backend/frontend? https://processwire.com/talk/topic/6343-how-to-add-more-fields-for-processwires-user/ regards mr-fan 1 Link to comment Share on other sites More sharing options...
hafa Posted October 13, 2014 Author Share Posted October 13, 2014 Ha, found out how a couple of minutes later after posting 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? Link to comment Share on other sites More sharing options...
Philipp Posted October 13, 2014 Share Posted October 13, 2014 The "user" is basically just another Page. So you can add a field to the user template and access it from the API. Create a field for your name, e.g. fullname. Or use an existing one Go to Site > Setup > Templates and then click on "Filter". Enable that system-templates are shown Edit the "user" template and add your fullname field. Save Go to your users profile and enter your name 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. 5 Link to comment Share on other sites More sharing options...
hafa Posted October 13, 2014 Author Share Posted October 13, 2014 The "user" is basically just another Page. So you can add a field to the user template and access it from the API. Create a field for your name, e.g. fullname. Or use an existing one Go to Site > Setup > Templates and then click on "Filter". Enable that system-templates are shown Edit the "user" template and add your fullname field. Save Go to your users profile and enter your name 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? Link to comment Share on other sites More sharing options...
Philipp Posted October 13, 2014 Share Posted October 13, 2014 It's a property of the $page that returns the last user that modified the page. See: http://cheatsheet.processwire.com/page/built-in-fields-reference/page-modifieduser/ Link to comment Share on other sites More sharing options...
hafa Posted October 13, 2014 Author Share Posted October 13, 2014 Ok, thank you Link to comment Share on other sites More sharing options...
Craig Posted October 13, 2014 Share Posted October 13, 2014 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. 2 Link to comment Share on other sites More sharing options...
Beluga Posted July 15, 2015 Share Posted July 15, 2015 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! Link to comment Share on other sites More sharing options...
LostKobrakai Posted July 15, 2015 Share Posted July 15, 2015 You need to edit the ProcessProfile module. There you can chose out of the template's fields which one are visible. 1 Link to comment Share on other sites More sharing options...
Beluga Posted July 16, 2015 Share Posted July 16, 2015 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now