function masquerade_context_condition::is_being_masqueraded in Masquerade Extras 7
Same name and namespace in other branches
- 6.2 masquerade_context/plugins/condition/masquerade_context.inc \masquerade_context_condition::is_being_masqueraded()
- 7.2 masquerade_context/plugins/condition/masquerade_context.inc \masquerade_context_condition::is_being_masqueraded()
Evaluates if the account is being masqueraded by someone else.
@returns TRUE if someone else is posing as account. FALSE otherwise. @retval bool
Parameters
stdClass $account: The user account to evaluate.
1 call to masquerade_context_condition::is_being_masqueraded()
- masquerade_context_condition::execute_is_being_masqueraded in masquerade_context/
plugins/ condition/ masquerade_context.inc - Evaluates if someone is posing as the account.
File
- masquerade_context/
plugins/ condition/ masquerade_context.inc, line 180 - Expose masquerade as a customizable context condition.
Class
- masquerade_context_condition
- @file Expose masquerade as a customizable context condition.
Code
function is_being_masqueraded($account) {
// You can override this query with:
// hook_query_context_is_being_masqueraded_alter().
// @see hook_query_TAG_alter()
$query = db_select('masquerade', 'm')
->addTag('context_is_being_masqueraded')
->fields('m', array(
'uid_from',
))
->condition('uid_as', $account->uid, '=')
->range(0, 1)
->execute();
$result = $query
->fetchCol();
return !empty($result);
}