user_build
- Versions
- 7
user_build($account, $build_mode = 'full')
Generate an array for rendering the given user.
When viewing a user profile, the $page array contains:
- $page['content']['Profile Category']: Profile categories keyed by their human-readable names.
- $page['content']['Profile Category']['profile_machine_name']: Profile fields keyed by their machine-readable names.
- $page['content']['user_picture']: User's rendered picture.
- $page['content']['summary']: Contains the default "History" profile data for a user.
- $page['content']['#account']: The user account of the profile being viewed.
To theme user profiles, copy modules/user/user-profile.tpl.php to your theme directory, and edit it as instructed in that file's comments.
Parameters
$account A user object.
$build_mode Build mode, e.g. 'full'.
Return value
An array as expected by drupal_render().
Code
modules/user/user.module, line 2139
<?php
function user_build($account, $build_mode = 'full') {
// Retrieve all profile fields and attach to $account->content.
user_build_content($account, $build_mode);
$build = $account->content;
// We don't need duplicate rendering info in account->content.
unset($account->content);
$build += array(
'#theme' => 'user_profile',
'#account' => $account,
'#build_mode' => $build_mode,
);
// Allow modules to modify the structured user.
drupal_alter('user_build', $build);
return $build;
}
?>Login or register to post comments 