function user_logout

Menu callback; logs the current user out, and redirects to the home page.

1 call to user_logout()
user_menu_site_status_alter in drupal/core/modules/user/user.module
Implements hook_menu_site_status_alter().
1 string reference to 'user_logout'
user_menu in drupal/core/modules/user/user.module
Implements hook_menu().

File

drupal/core/modules/user/user.pages.inc, line 173
User page callback file for the user module.

Code

function user_logout() {
  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();
  drupal_goto();
}