diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-01-07 18:01:13 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-01-07 18:01:13 +0000 |
commit | 0f91dce4149e891b7a67fe18ff211cc95c0c4412 (patch) | |
tree | 384d9909068d66d2cd205aacdeffd45d565c9a3e | |
parent | 1e66e1ff753ce35e89c29e1b00cce24768aed9b6 (diff) | |
download | brdo-0f91dce4149e891b7a67fe18ff211cc95c0c4412.tar.gz brdo-0f91dce4149e891b7a67fe18ff211cc95c0c4412.tar.bz2 |
- Patch #15247 by Drumm: simplified the logout code.
-rw-r--r-- | modules/user.module | 28 | ||||
-rw-r--r-- | modules/user/user.module | 28 |
2 files changed, 20 insertions, 36 deletions
diff --git a/modules/user.module b/modules/user.module index 6c9852b92..ea376535c 100644 --- a/modules/user.module +++ b/modules/user.module @@ -691,15 +691,12 @@ function user_menu($may_cache) { if ($user->uid) { $items[] = array('path' => 'user/'. $user->uid, 'title' => t('my account'), 'callback' => 'user_page', 'access' => TRUE); - $items[] = array('path' => 'logout', 'title' => t('log out'), - 'access' => TRUE, - 'callback' => 'user_logout', - 'weight' => 10); - } - else { - $items[] = array('path' => 'logout', 'title' => t('log out'), - 'callback' => 'user_logout', 'access' => FALSE); } + + $items[] = array('path' => 'logout', 'title' => t('log out'), + 'access' => $user->uid != 0, + 'callback' => 'user_logout', + 'weight' => 10); } else { if (arg(0) == 'user' && is_numeric(arg(1))) { @@ -897,14 +894,12 @@ function _user_authenticated_id() { function user_logout() { global $user; - if ($user->uid) { - watchdog('user', t('Session closed for %name.', array('%name' => "<em>$user->name</em>"))); + watchdog('user', t('Session closed for %name.', array('%name' => '<em>'. $user->name .'</em>'))); - // Destroy the current session: - session_destroy(); - module_invoke_all('user', 'logout', NULL, $user); - unset($user); - } + // Destroy the current session: + session_destroy(); + module_invoke_all('user', 'logout', NULL, $user); + unset($user); drupal_goto(); } @@ -1215,9 +1210,6 @@ function user_page() { case 'login': print theme('page', user_login($edit)); break; - case 'logout': - print user_logout(); - break; default: if (!arg(1)) { if ($user->uid) { diff --git a/modules/user/user.module b/modules/user/user.module index 6c9852b92..ea376535c 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -691,15 +691,12 @@ function user_menu($may_cache) { if ($user->uid) { $items[] = array('path' => 'user/'. $user->uid, 'title' => t('my account'), 'callback' => 'user_page', 'access' => TRUE); - $items[] = array('path' => 'logout', 'title' => t('log out'), - 'access' => TRUE, - 'callback' => 'user_logout', - 'weight' => 10); - } - else { - $items[] = array('path' => 'logout', 'title' => t('log out'), - 'callback' => 'user_logout', 'access' => FALSE); } + + $items[] = array('path' => 'logout', 'title' => t('log out'), + 'access' => $user->uid != 0, + 'callback' => 'user_logout', + 'weight' => 10); } else { if (arg(0) == 'user' && is_numeric(arg(1))) { @@ -897,14 +894,12 @@ function _user_authenticated_id() { function user_logout() { global $user; - if ($user->uid) { - watchdog('user', t('Session closed for %name.', array('%name' => "<em>$user->name</em>"))); + watchdog('user', t('Session closed for %name.', array('%name' => '<em>'. $user->name .'</em>'))); - // Destroy the current session: - session_destroy(); - module_invoke_all('user', 'logout', NULL, $user); - unset($user); - } + // Destroy the current session: + session_destroy(); + module_invoke_all('user', 'logout', NULL, $user); + unset($user); drupal_goto(); } @@ -1215,9 +1210,6 @@ function user_page() { case 'login': print theme('page', user_login($edit)); break; - case 'logout': - print user_logout(); - break; default: if (!arg(1)) { if ($user->uid) { |