user_logout
- Versions
- 4.6 – 7
user_logout()
Menu callback; logs the current user out, and redirects to the home page.
Code
modules/user/user.module, line 1038
<?php
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();
}
?>Login or register to post comments 