Thursday, March 28, 2024

Featured Drupal Module: RealName

Web users are accustomed to supplying a username for sites that they frequent. Unlike other applications, Drupal allows a user to select a username that includes a space; so, one could use their actual name. But, with so many sites requiring a username, members are more likely to just use the same one they do for other sites. That might be convenient for logging in to the site, but it does not work well as a display name for authored posts. If you have a site with original content, you don’t want your feature article to show authored by JetsFan1982. Obviously, that won’t build your reputation for serious journalism.

The Drupal module “RealName” offers a seamless transition between that login username and a displayed byline. Through the module options, a site developer can create a new field that holds the display name separate from the username. RealName then will automatically substitute that name wherever a byline is displayed. The new field can be made optional so that site visitors can post comments with a more obscure username (for privacy), while content creators can provide a byline for proper crediting.

screenshot of realname module live use

Configuring the Module

After installing the module, the first thing that you will need to do is to create the new field(s) through Drupal core Profile (or Content Profile contributed module, if you prefer) to be used as the “real name”. This could be individual text fields for first name, middle name, last name. Or, if your intent is specific for byline, simply a single field “byline”.

screenshot of profile module fields

In this example for Overseas Press Club of America, I wanted the byline field to be part of the mandatory registration form of core Profile, so I chose to include a single “byline” field on that form. This site uses an elaborate, optional profile (using the Content Profile module) that collects first, middle, and last name data. But, writers tend to be particular about their byline — perhaps preferring some variation of their full name or a unique nom de plume (pen name). The RealName module facilitates this customization nicely. So, for example, using the added byline field, “Joanne Kathleen Rowling” can elect to display her postings as “by J.K. Rowling” but be noted in the member directory by her full name.

Module Options: General

The RealName module offers flexibility in what you choose to automate. Enabling “Show realname in nodes” will provide that new byline.

screenshot of database schedule creation

Another way in which you might use this module is for a members directory or Who’s Online block, which you would build in views. Enabling the “Overwrite user fields in view to show realnames” option will simplify the operation of showing the “real name”.

The option to rename the “My account” link is a nice bonus.

Module Options: Fields

Once you have created the new “real name” fields, you need to associate them to your user object.

screenshot of RealName module fields option

Module Options: Modules

The Modules tab will show you the installed modules that are capable of integrating with RealName, and allow you to select one.

screenshot of RealName module modules option

Module Options: Bypass Forms

The Bypass Forms option lets you exclude some forms from making the “real name” substitution.

screenshot of RealName module bypass forms option

Module Options: Recalculate Names

And, to recalculate all of the “real names”, you click the rebuild realnames button on the Recalculate Names tab.

screenshot of RealName module recalculate names option

Summary

As you can see, the RealName module is simple and easy to implement. Sure, you could accomplish the same goal using profile fields, views, and theme overrides. But, for those who are not comfortable venturing into that advanced development (or who just want to be lazy…holler!), the RealName module is “just what you need”. Shout out to developer NancyDru — real name Nancy Wichmann, for this handy module. NancyDru tends to write hidden gems, or “scratch an itch” modules, as she’d say. (Who doesn’t love a good NancyDru mystery.) Stay tuned to HTMLGoodies.com to learn about her Taxonomy Image module.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured