user_logout()
user/user.module, line 1033
Menu callback; logs the current user out, and redirects to the home page.
<?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();
}
?>