You are here

function masquerade_ctools_is_being_masqueraded in Masquerade Extras 7.2

Same name and namespace in other branches
  1. 6.2 masquerade_ctools/masquerade_ctools.module \masquerade_ctools_is_being_masqueraded()

Evaluate if the account provided is in use by another user.

@returns TRUE if the account provided is being masqueraded. FALSE otherwise. @retval bool

Parameters

int|stdClass $account: The user account (or id) to evaluate.

2 calls to masquerade_ctools_is_being_masqueraded()
masquerade_ctools_masquerade_access_check in masquerade_ctools/plugins/access/masquerade.inc
Checks masquerade conditions. If no context is provided, this will automatically return FALSE.
masquerade_ctools_user_from_masquerade_context in masquerade_ctools/plugins/relationships/user_from_masquerade.inc
Retrieves the user info from the context.

File

masquerade_ctools/masquerade_ctools.module, line 64
Allows Ctools to look for masquerade plugins.

Code

function masquerade_ctools_is_being_masqueraded($account) {
  if (is_object($account)) {
    $account = $account->uid;
  }

  // You can override this database query with:
  // hook_query_masquerade_ctools_is_masquerading_alter().
  // @see hook_query_TAG_alter()
  $query = db_select('masquerade', 'm')
    ->addTag('masquerade_ctools_is_being_masqueraded')
    ->fields('m', array(
    'uid_from',
  ))
    ->condition('uid_as', $account, '=')
    ->range(0, 1)
    ->execute();
  $result = $query
    ->fetchCol();
  return !empty($result);
}