I would like to display the custom user profile field name as the author's name in articles, instead of the user's username. How can I do this without modifying code of my template or Drupal itself?

I saw solutions for Drupal 7 but I'm using Drupal 8. I found custom modules for Drupal 7 or earlier and code modification ways. Both seems wrong to me because the mentioned modules aren't updated nor it feels correctly to me to change code to achieve this quite basic task.


You can use the Realname module to override the display name with the values of one or more fields:

The RealName module allows the administrator to choose fields from the user profile that will be used to add a "real name" element (method) to a user object. Hook_user is used to automatically add this to any user object that is loaded. It will also optionally set all nodes and comments to show this name.

  • So there is really no other way than RealName module which is in release candidate 1 phase right now for Drupal 8? This feels bad :/. I had expected bigger flexibility of Drupal 8. – CodeShark Jul 16 '17 at 14:04
  • Why would you need bigger flexibility? Realname is a relatively small module and any other module implementing the same functionalty would ver very similar. There is no need for another module. – Neograph734 Jul 16 '17 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.