diff --git a/masquerade.module b/masquerade.module index 5c7da88..0534b2e 100644 --- a/masquerade.module +++ b/masquerade.module @@ -364,10 +364,10 @@ function _masquerade_user_load($username) { * Implements hook_user_logout(). */ function masquerade_user_logout($account) { - if (!empty($account->masquerading)) { + if (!empty($_SESSION['masquerading'])) { global $user; cache_clear_all($user->uid, 'cache_menu', TRUE); - $real_user = user_load($user->masquerading); + $real_user = user_load($_SESSION['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');