function hook_user_view

The user's account information is being displayed.

The module should format its custom additions for display and add them to the $account->content array.

Parameters

$account: The user object on which the operation is being performed.

$view_mode: View mode, e.g. 'full'.

$langcode: The language code used for rendering.

See also

hook_user_view_alter()

hook_entity_view()

Related topics

1 function implements hook_user_view()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

user_user_view in drupal/core/modules/user/user.module
Implements hook_user_view().

File

drupal/core/modules/user/user.api.php, line 346
Hooks provided by the User module.

Code

function hook_user_view($account, $view_mode, $langcode) {
  if (!isset($account->content['summary'])) {
    $account->content['summary'] = array();
  }
  $account->content['summary'] += array(
    '#type' => 'user_profile_category',
    '#title' => t('History'),
    '#attributes' => array(
      'class' => array(
        'user-member',
      ),
    ),
    '#weight' => 5,
  );
  $account->content['summary']['member_for'] = array(
    '#type' => 'user_profile_item',
    '#title' => t('Member for'),
    '#markup' => format_interval(REQUEST_TIME - $account->created),
  );
}