You are here

function bakery_user_logout in Bakery Single Sign-On System 6

Same name and namespace in other branches
  1. 8.2 bakery.module \bakery_user_logout()
  2. 6.2 bakery.module \bakery_user_logout()
  3. 7.4 bakery.module \bakery_user_logout()
  4. 7.2 bakery.module \bakery_user_logout()
  5. 7.3 bakery.module \bakery_user_logout()

Custom logout function modified from user_logout.

1 call to bakery_user_logout()
_bakery_taste_chocolatechip_cookie in ./bakery.module
Test identification cookie

File

./bakery.module, line 707

Code

function bakery_user_logout() {
  global $user;
  watchdog('user', 'Session closed for %name.', array(
    '%name' => $user->name,
  ));

  // Destroy the current session:
  session_destroy();
  module_invoke_all('user', 'logout', NULL, $user);

  // Load the anonymous user
  $user = drupal_anonymous_user();

  // We want to redirect the user to his original destination.
  $get = $_GET;
  $destination = $get['q'];
  unset($get['q']);

  // We append a GET parameter so that the browser reloads the
  // page.
  $get['no_cache'] = time();
  drupal_goto($destination, $get, NULL, 307);
}