hook_user_view

Versions
7
hook_user_view($account, $build_mode)

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.

$build_mode Build mode, e.g. 'full'.

Related topics

Code

modules/user/user.api.php, line 319

<?php
function hook_user_view($account, $build_mode) {
  if (user_access('create blog content', $account)) {
    $account->content['summary']['blog'] =  array(
      '#type' => 'user_profile_item',
      '#title' => t('Blog'),
      '#markup' => l(t('View recent blog entries'), "blog/$account->uid", array('attributes' => array('title' => t("Read !username's latest blog entries.", array('!username' => format_username($account)))))),
      '#attributes' => array('class' => array('blog')),
    );
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.