function user_logout

7.x user.pages.inc user_logout()
6.x user.pages.inc 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-7.x/modules/user/user.module
Implements hook_menu_site_status_alter().
5 string references to 'user_logout'
TriggerUserTokenTestCase::testUserTriggerTokenReplacement in drupal-7.x/modules/trigger/trigger.test
Tests a variety of token replacements in actions.
trigger_test_action_info in drupal-7.x/modules/trigger/tests/trigger_test.module
Implements hook_action_info().
trigger_trigger_info in drupal-7.x/modules/trigger/trigger.module
Implements hook_trigger_info().
trigger_user_logout in drupal-7.x/modules/trigger/trigger.module
Implements hook_user_logout().
user_menu in drupal-7.x/modules/user/user.module
Implements hook_menu().

File

drupal-7.x/modules/user/user.pages.inc, line 170
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();
}