Session should be destroyed after invoke hook_user_logout($account) so that variable $account is still active

diff --git a/sites/all/modules/autologout/autologout.module b/sites/all/modules/autologout/autologout.module
index 834162b..dab86ec 100644
--- a/sites/all/modules/autologout/autologout.module
+++ b/sites/all/modules/autologout/autologout.module
@@ -223,15 +223,11 @@ function autologout_init() {
// code from core(user.pages.inc), can't use it directly because we need need a custom goto
watchdog('user', 'Session closed for %name.', array('%name' => $user->name));

- // Destroy the current session:
- session_destroy();
- // Only variables can be passed by reference workaround.
- $null = NULL;
- user_module_invoke('logout', $null, $user);
-
- // Load the anonymous user
- $user = drupal_anonymous_user();
+ module_invoke_all('user_logout', $user);

+ // Destroy the current session, and reset $user to the anonymous user.
+ session_destroy();
+
$redirect_url = filter_xss_admin(_autologout_local_settings('redirect_url'));
if ( $redirect_url != '' ) {
drupal_goto($redirect_url);

CommentFileSizeAuthor
patch.diff1.05 KBipallian

Comments

jrglasgow’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 81cc35f on 7.x-2.x, 7.x-5.x, 7.x-4.0, 8.x-1.x authored by ipallian, committed by jrglasgow:
    Issue #1544138 by ipallian: Fixed session is destroyed before invoke...