function user_logout

Logs the current user out.

2 calls to user_logout()
MaintenanceModeSubscriber::onKernelRequestMaintenance in drupal/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
Determine whether the page is configured to be offline.
UserController::logout in drupal/core/modules/user/lib/Drupal/user/Controller/UserController.php
Logs the current user out.
1 string reference to 'user_logout'
user_menu in drupal/core/modules/user/user.module
Implements hook_menu().

File

drupal/core/modules/user/user.module, line 2617
Enables the user registration and login system.

Code

function user_logout() {
  global $user;
  watchdog('user', 'Session closed for %name.', array(
    '%name' => $user->name,
  ));
  Drupal::moduleHandler()
    ->invokeAll('user_logout', array(
    $user,
  ));

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