Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home1/tylerfra/public_html/includes/common.inc).

Drupal - Change the Output of "Member for" on User Profiles

Category: 
Tags: 

When viewing a user account profile page in Drupal, by default the "History" field is displayed like so:

Surprisingly after 7 years of Drupal development, no client has ever asked me to change this display, other than hiding it on occasion.

Changing how this is rendered is quite easy, just implement hook_user_view_alter(), and try something like this:

/**
 * Implements hook_user_view_alter().
 */
function my_module_user_view_alter(&$build) {
  $build['summary']['#title'] = '';
  $build['summary']['member_for']['#title'] = t('Member since');
  $build['summary']['member_for']['#markup'] = date('Y', $build['#account']->created);
}

This will render output like this:

Comments

No cording is necessary

/admin/config/people/accounts/display

Configuration / People / Account settings / Manage display

Setting "History" to "Hidden"