function user_view

user_view($account, $view_mode = 'full', $langcode = NULL)

Generate an array for rendering the given user.

When viewing a user profile, the $page array contains:

  • $page['content']['member_for']: Contains the default "Member for" profile data for a user.
  • $page['content']['#user']: The user account of the profile being viewed.

To theme user profiles, copy core/modules/user/templates/user.html.twig to your theme directory, and edit it as instructed in that file's comments.

Parameters

\Drupal\user\UserInterface $account: A user object.

string $view_mode: View mode, e.g. 'full'.

string|null $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

Return value

array An array as expected by drupal_render().

File

core/modules/user/user.module, line 883
Enables the user registration and login system.

Code

function user_view($account, $view_mode = 'full', $langcode = NULL) {
  return entity_view($account, $view_mode, $langcode);
}

© 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/core!modules!user!user.module/function/user_view/8.1.x