You are here

function user_view in Drupal 5

Same name and namespace in other branches
  1. 8 core/modules/user/user.module \user_view()
  2. 4 modules/user.module \user_view()
  3. 6 modules/user/user.pages.inc \user_view()
  4. 7 modules/user/user.module \user_view()
1 string reference to 'user_view'
user_menu in modules/user/user.module
Implementation of hook_menu().

File

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

Code

function user_view($uid = 0) {
  global $user;
  $account = user_load(array(
    'uid' => $uid,
  ));
  if ($account === FALSE || $account->access == 0 && !user_access('administer users')) {
    return drupal_not_found();
  }

  // Retrieve and merge all profile fields:
  $fields = array();
  foreach (module_list() as $module) {
    if ($data = module_invoke($module, 'user', 'view', '', $account)) {
      foreach ($data as $category => $items) {
        foreach ($items as $key => $item) {
          $item['class'] = "{$module}-" . $item['class'];
          $fields[$category][$key] = $item;
        }
      }
    }
  }

  // Let modules change the returned fields - useful for personal privacy
  // controls. Since modules communicate changes by reference, we cannot use
  // module_invoke_all().
  foreach (module_implements('profile_alter') as $module) {
    $function = $module . '_profile_alter';
    $function($account, $fields);
  }
  drupal_set_title(check_plain($account->name));
  return theme('user_profile', $account, $fields);
}