user_logout
Definition
user_logout()
modules/user/user.pages.inc, line 143
Description
Menu callback; logs the current user out, and redirects to the home page.
Code
<?php
function user_logout() {
global $user;
watchdog('user', '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();
}
?> 