function hook_user_view

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 user.api.php hook_user_view($account, $view_mode, $langcode)
cle7 user.api.php hook_user_view($account, $view_mode, $langcode)
elmsmedia7 user.api.php hook_user_view($account, $view_mode, $langcode)
icor7 user.api.php hook_user_view($account, $view_mode, $langcode)
meedjum_blog7 user.api.php hook_user_view($account, $view_mode, $langcode)
mooc7 user.api.php 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.

Note that when this hook is invoked, the changes have not yet been written to the database, because a database transaction is still in progress. The transaction is not finalized until the save operation is entirely completed and user_save() goes out of scope. You should not rely on data in the database at this time as it is not updated yet. You should also note that any write/update database queries executed from this hook are also not committed immediately. Check user_save() and db_transaction() for more info.

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

8 functions implement 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.

bakery_user_view in sites/all/modules/ulmus/bakery/bakery.module
Implements hook_user_view().
blog_user_view in modules/blog/blog.module
Implements hook_user_view().
context_user_view in sites/all/modules/ulmus/context/context.core.inc
Implementation of hook_user().
masquerade_user_view in sites/all/modules/ulmus/masquerade/masquerade.module
Implements hook_user_view().
og_context_handler_user_view in sites/all/modules/ulmus/og/og_context/og_context.module
Context handler; Get groups from user view.

... See full list

5 invocations of hook_user_view()
ctools_node_content_render_node in sites/all/modules/ulmus/ctools/plugins/content_types/node_context/node_content.inc
field_attach_view in modules/field/field.attach.inc
Returns a renderable array for the fields on an entity.
field_view_field in modules/field/field.module
Returns a renderable array for the value of a single field in an entity.
node_build_content in modules/node/node.module
Builds a structured array representing the node's content.
user_build_content in modules/user/user.module
Builds a structured array representing the profile content.

File

modules/user/user.api.php, line 348
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')),
    );
  }
}