function _masquerade_drush_get_user in Masquerade Extras 7.2
Same name and namespace in other branches
- 6.2 masquerade_drush/masquerade_drush.drush.inc \_masquerade_drush_get_user()
Retrieves a user account.
@retval stdClass
Parameters
string $account: The user ID, email address, or account name we want to load.
Return value
Loads the base user.
5 calls to _masquerade_drush_get_user()
- _masquerade_drush_list in masquerade_drush/
masquerade_drush.drush.inc - Displays a table of active masquerades in the site.
- _masquerade_drush_sessions in masquerade_drush/
masquerade_drush.drush.inc - Utility command to dump the active sessions table from the site.
- _masquerade_drush_sessions_terminate in masquerade_drush/
masquerade_drush.drush.inc - Ends a user's session.
- _masquerade_drush_start_masquerade in masquerade_drush/
masquerade_drush.drush.inc - Initializes a masquerade on the user's behalf. This is useful when developing and you want the user to start masquerading as soon as they login to the site.
- _masquerade_drush_terminate_masquerade in masquerade_drush/
masquerade_drush.drush.inc - Deletes active masquerades from the database. This is exceptionally useful when an active masquerade is causing a development problem and the user can't end the masquerade.
File
- masquerade_drush/
masquerade_drush.drush.inc, line 153 - Provides some drush commands for masquerade.
Code
function _masquerade_drush_get_user($account) {
$or = db_or()
->condition('name', $account, '=')
->condition('mail', $account, '=')
->condition('uid', $account, '=');
$user = db_select('users', 'u')
->fields('u')
->condition($or)
->execute()
->fetchObject();
if (!empty($user)) {
return user_load($user->uid);
}
return FALSE;
}