RealName: Using Profile fields to set a user's displayed name

You've spent a lot of time and effort setting up nice profile fields for your user's name. Aren't you tired of seeing "Submitted by Nancy on Sun, June 1, 2008 at 8:00 am?" Wouldn't it be nice if it said "Submitted by Miss Nancy the Great ..." instead? Or how about all those user links saying the name you set up rather than just "Nancy"?

Concerned about privacy? "Real Name" doesn't necessarily mean their legal name; it means a name composed of one or more fields taken from their user profile, rather than their login name. Additionally, this module supports the Profile Privacy module which gives them the ability to turn off the use of any of those fields. As an example, my test site shows me as "Beautiful Webmistress."

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. The RealName will also be placed into the Contact forms (both site and user). It will also optionally set all nodes to show this name.

As of November 3, 2008, the 5.x and 6.x versions diverge. The 6.x version now allows both the core Profile module and the contributed Content Profile module to provide data for the Real Name.

Installation

Standard module installation applies.

Menus

The only menu items are for the settings pages.

Settings

The settings page is at Administer >> User >> Realname.

This is where you choose which fields from the profile will be used to create the user's RealName. For 6.x, you must first select which module to be used (if you have more than one available) and the content type that is provided by that module (currently only one type may be specified).

Note: Currently, for the core profile module, only "single line textfield" data will be shown; for the Content Profile, only single value text fields may be used. This may be improved in the near future.

The "Pattern" value allows you to format the pieces of the name. Each of the fields selected above are assigned a number, so the pattern uses "%1" for the first field (after weighting is applied), "%2" is for the second field, etc.

"Override username theme": If this option is selected, the standard username theme function will be overridden to use the "Real name."

"Show realname in nodes": If this option is selected, the "Real name" will be used on node displays.

"Show 'Not verified' for anonymous users": Drupal core adds "Not verified" for anonymous users when theming the user name, this option allows that to be turned off.

"Link to homepage": This setting will appear only if there are URL fields in the profile, or, for Content Profile, "link" fields. If one of those fields is a link to the user's home page and you want it to be used instead of linking to the user's profile, choose that field here.

"Spam link deterrent": This will only show up if the previous setting shows up. It allows you to add a rel="nofollow" to the homepage link to prevent spam links from hurting your SEO.

Permissions

There is one new permission, "use realname." This allows you to control which roles see the realname and which don't. Additionally, if you want the Real Name to show up as a link to the user profile or homepage, the role must also have the "access user profiles" permission.

The settings page is controlled by the "administer users" permission.

Tokens

If the Token module is available, this module will provide the real name, the link (using theme_username), and the homepage URL (if it is available).

In Drupal 7.x, realname depends on the Token module for its functionality.

Problems

As always, issues should be reported in the issue queue rather than here.

RealName: Supporting an Alternate Module

The Real Name module can be extended to support other modules that may supply data to Real Name. This capability was designed to be somewhat

RealName: theme_username

The RealName module intercepts the theme('username',...) and allows extensions in keeping with core issue [#192056].

Realname for Drupal 7

The Realname module for Drupal 7 is very different from previous versions.

Realname: Altering the name on the Navigation menu

The User module produces the Navigation menu block. Strangely, it fails to use its own theme code to show the name (see [#192056]). Since

Realname: Remove 15 characters username trim

In case your user has long realname (15+ characters), such username will be trimmed to 15 characters and "..." added by default. If you wish

Guide maintainers

nancydru's picture