hook_user_view
function hook_user_view
hook_user_view($account, $view_mode, $langcode)
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
Related topics
File
- modules/user/user.api.php, line 356
- Hooks provided by the User module.
Code
function hook_user_view($account, $view_mode, $langcode) { 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')), ); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.api.php/function/hook_user_view/7.x