1 user.pages.inc user_logout_current_user()

Logs the current user out.

File

core/modules/user/user.pages.inc, line 313
User page callback file for the user module.

Code

function user_logout_current_user() {
  global $user;

  watchdog('user', 'Session closed for %name.', array('%name' => $user->name));

  module_invoke_all('user_logout', $user);

  $entity_info = entity_get_info('user');
  if (isset($entity_info['entity cache']) && $entity_info['entity cache']) {
    cache('entity_user')->delete($user->uid);
  }

  // Destroy the current session, and reset $user to the anonymous user.
  session_destroy();
}