You are here

function masquerade_ctools_is_masquerading in Masquerade Extras 6.2

Same name and namespace in other branches
  1. 7.2 masquerade_ctools/masquerade_ctools.module \masquerade_ctools_is_masquerading()

Checks if the provided account is masquerading.

@retval bool

Parameters

stdClass $account: The user account to check.

Return value

TRUE if the provided account is masquerading. FALSE otherwise.

2 calls to masquerade_ctools_is_masquerading()
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 31
Allows Ctools to look for masquerade plugins.

Code

function masquerade_ctools_is_masquerading($account) {
  global $user;
  if ($user->uid == $account->uid) {
    return isset($_SESSION['masquerading']) && is_numeric($_SESSION['masquerading']);
  }
  $query_is_masquerading = db_query("SELECT `uid_as`\n       FROM {masquerade}\n      WHERE `uid_from` = %d\n      LIMIT 1", $account->uid);
  return (bool) db_result($query_is_masquerading);
}