function user_view_access
User view access callback.
Parameters
$account: Can either be a full user object or a $uid.
2 calls to user_view_access()
- user_file_download_access in modules/
user/ user.module - Implements hook_file_download_access().
- _tracker_user_access in modules/
tracker/ tracker.module - Access callback for user/%user/track.
1 string reference to 'user_view_access'
- user_menu in modules/
user/ user.module - Implements hook_menu().
File
-
modules/
user/ user.module, line 1604
Code
function user_view_access($account) {
$uid = is_object($account) ? $account->uid : (int) $account;
// Never allow access to view the anonymous user account.
if ($uid) {
// Admins can view all, users can view own profiles at all times.
if ($GLOBALS['user']->uid == $uid || user_access('administer users')) {
return TRUE;
}
elseif (user_access('access user profiles')) {
// At this point, load the complete account object.
if (!is_object($account)) {
$account = user_load($uid);
}
return is_object($account) && $account->status;
}
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.