You are here

function masquerade_user_logout in Masquerade 7

Implements hook_user_logout().

2 calls to masquerade_user_logout()
masquerade_switch_back in ./masquerade.module
Function for a masquerading user to switch back to the previous user.
masquerade_switch_user in ./masquerade.module
Allows a user with the right permissions to become the selected user.

File

./masquerade.module, line 366
The masquerade module allows administrators to masquerade as other user.

Code

function masquerade_user_logout($account) {
  if (!empty($account->masquerading)) {
    global $user;
    cache_clear_all($user->uid, 'cache_menu', TRUE);
    $real_user = user_load($user->masquerading);
    watchdog('masquerade', "User %user no longer masquerading as %masq_as.", array(
      '%user' => $real_user->name,
      '%masq_as' => $user->name,
    ), WATCHDOG_INFO);
    $query = db_delete('masquerade');
    $query
      ->condition('sid', session_id());
    $query
      ->condition('uid_as', $account->uid);
    $query
      ->execute();
  }
}