You are here

function user_logout_current_user in Drupal 7

Logs the current user out.

2 calls to user_logout_current_user()
user_logout in modules/user/user.pages.inc
Menu callback; logs the current user out, and redirects to the home page.
user_pass_reset in modules/user/user.pages.inc
Menu callback; process one time login link and redirects to the user page on success.

File

modules/user/user.pages.inc, line 284
User page callback file for the user module.

Code

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

  // Destroy the current session, and reset $user to the anonymous user.
  session_destroy();
}