function user_logout in Drupal 6
Same name and namespace in other branches
- 8 core/modules/user/user.module \user_logout()
- 4 modules/user.module \user_logout()
- 5 modules/user/user.module \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 call to user_logout()
- _menu_site_is_offline in includes/
menu.inc - Checks whether the site is off-line for maintenance.
1 string reference to 'user_logout'
- user_menu in modules/
user/ user.module - Implementation of hook_menu().
File
- modules/
user/ user.pages.inc, line 145 - User page callback file for the user module.
Code
function user_logout() {
global $user;
watchdog('user', 'Session closed for %name.', array(
'%name' => $user->name,
));
// Destroy the current session:
session_destroy();
// Only variables can be passed by reference workaround.
$null = NULL;
user_module_invoke('logout', $null, $user);
// Load the anonymous user
$user = drupal_anonymous_user();
drupal_goto();
}