function _masquerade_user_load in Masquerade 6
Same name and namespace in other branches
- 7 masquerade.module \_masquerade_user_load()
Wrapper around user_load() to allow the loading of anonymous users.
Parameters
$username: The username of the user you wish to load (i.e. $user->name). To load the anonymous user, pass the value of the 'anonymous' variable.
Return value
A fully-loaded $user object upon successful user load or FALSE if user cannot be loaded.
4 calls to _masquerade_user_load()
- masquerade_admin_settings in ./
masquerade.module - masquerade_admin_settings_validate in ./
masquerade.module - masquerade_menu in ./
masquerade.module - Implementation of hook_menu().
- masquerade_menu_alter in ./
masquerade.module - Implementation of hook_menu_alter().
File
- ./
masquerade.module, line 299 - masquerade.module
Code
function _masquerade_user_load($username) {
if (!empty($username)) {
$user = '';
$anon = variable_get('anonymous', t('Anonymous'));
if ($username == $anon) {
$user = user_load(array(
'name' => '',
));
$user->name = $anon;
}
else {
$user = user_load(array(
'name' => $username,
));
}
return $user;
}
return FALSE;
}