Add an extra field to a user display


/**
 * Implements hook_field_extra_fields().
 */
function MYMODULE_field_extra_fields() {
  $extra['user']['user'] = array (
    'display' => array(
      'extra_field' => array(
        'label' => t('User extra field'),
        'description' => t('Adds an extra field to a user view.'),
        'weight' => -99,
      )
    )
  );

  return $extra;
}

/**
 * Implements hook_user_view(). 
 */
function MYMODULE_user_view($account, $view_mode, $langcode) {
  $account->content['extra_user_transfer_link'] = array('#markup' => 'Data');
}

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.