| Versionen | |
|---|---|
| drupal6 – drupal7 | user_logout() |
Menu callback; logs the current user out, and redirects to the home page.
modules/
<?php
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();
}
?>
Kommentare
Kommentar hinzufügen