Change Drupal Usernames with the Real Name Module

users

One of our members came to us with a question about usernames.

After installing the Advanced Forum module, they noticed that Drupal was posting usernames. The same thing was happening for comments and elsewhere on the site.

Our member wondered if it was possible to replace these plain usernames with people’s real names. Yes it is, if you use the Real name module.

One of our members came to us with a question about usernames.

After installing the Advanced Forum module, they noticed that Drupal was posting usernames. The same thing was happening for comments and elsewhere on the site.

Our member wondered if it was possible to replace these plain usernames with people’s real names. Yes it is, if you use the Real name module.

Installing Real Name

We’re going to need two modules:

Install and enable both of those modules.

Setting up the First Name and Last Name

  • Go to Configuration > Account settings > Manage fields
media_1371653247097.png

On this screen we’re able to add fields to our user accounts. If that’s surprising and you thought fields only applied to content, read our introduction to Drupal entities.

  • Add a field for First Name using Text as the type of data to store.
  • Add a field for Last Name using Text as the type of data to store.
media_1371653344427.png

Here’s how the fields for your user accounts might look:

media_1371653669757.png
  • Go to Configuration > Real name

By default only the raw username is being shown, as you can see at the top of the page.

media_1371653832539.png

You can use Tokens to change what is displayed. Further down the page, you’ll be able to see the tokens for First Name and Last Name.

  • Enter those tokens into the Realname pattern box:
media_1371653904535.png

Now if you visit the front of your site, you’ll see that the First Name and Last Name have replaced the username:

media_1371653927442.png

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Subscribe
Notify of
7 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Danny
Danny
10 years ago

Nice!

Just FYI, there is also a handy hook you can use to alter the display of usernames: hook_username_alter() – [url=https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_username_alter/7]https://api.drupal.org/api/…[/url]

Danny

Louise
Louise
8 years ago

I am using Realname which is great on a Drupal 7 commons site. However on the Edit account profile page it doesn’t display the realname id which I have set to firstname.lastname it displays the firstname underscore xxx (number) how do I update that to reflect the true display name used by the Realname module?

Muda'sir Abi
Muda'sir Abi
6 years ago

Is this realname module working fine with hybridauth users, I found it does not works.

Meloman
Meloman
6 years ago

Not working for me on poll module comments 🙁

Alex Mamatuik
Alex Mamatuik
2 years ago

Perfectly and simply explained, many thanks!

It was useful for my forum section, when i needed to hide real username (to keep safe a login data) 

mikall
2 years ago
Reply to  Alex Mamatuik

Awesome!! 

7
0
Would love your thoughts, please comment.x
()
x