| Drupal

usersOne 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

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.

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

  • Go to Configuration > Real name

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


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:

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


About the author

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.