Drupal - Change the Output of "Member for" on User Profiles
Category:
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
Sevenfish (not verified)
Thu, 12/17/2015 - 22:01
Permalink
No cording is necessary
No cording is necessary
/admin/config/people/accounts/display
Configuration / People / Account settings / Manage display
Setting "History" to "Hidden"