function user_logout in Drupal 5
Same name and namespace in other branches
- 8 core/modules/user/user.module \user_logout()
- 4 modules/user.module \user_logout()
- 6 modules/user/user.pages.inc \user_logout()
- 7 modules/user/user.pages.inc \user_logout()
- 9 core/modules/user/user.module \user_logout()
Menu callback; logs the current user out, and redirects to the home page.
1 string reference to 'user_logout'
- user_menu in modules/user/ user.module 
- Implementation of hook_menu().
File
- modules/user/ user.module, line 1038 
- Enables the user registration and login system.
Code
function user_logout() {
  global $user;
  watchdog('user', t('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();
  drupal_goto();
}