You are here

function realname_user_view in Real Name 7

Same name and namespace in other branches
  1. 8 realname.module \realname_user_view()
  2. 6 realname.module \realname_user_view()
  3. 2.x realname.module \realname_user_view()

Implements hook_user_view().

File

./realname.module, line 168
Provides token-based name displays for users.

Code

function realname_user_view($account, $view_mode, $langcode) {
  if (user_view_access($account)) {
    $markup = l($account->realname, 'user/' . $account->uid);
  }
  else {
    $markup = check_plain($account->realname);
  }
  $account->content['realname'] = array(
    '#entity_type' => 'custom',
    '#bundle' => 'custom',
    '#field_type' => 'text',
    '#theme' => 'field',
    '#field_name' => 'realname',
    '#title' => t('Real name'),
    '#label_display' => 'inline',
    '#items' => array(
      TRUE,
    ),
    0 => array(
      '#markup' => $markup,
    ),
  );
}