function user_logout

Same name and namespace in other branches
  1. 11.x core/modules/user/user.module \user_logout()
  2. 10 core/modules/user/user.module \user_logout()
  3. 9 core/modules/user/user.module \user_logout()
  4. 8.9.x core/modules/user/user.module \user_logout()
  5. 7.x modules/user/user.pages.inc \user_logout()

Logs the current user out.

Deprecated

in drupal:11.5.0 and is removed from drupal:13.0.0. Use \Drupal\user\LogoutFinalizer::finalizeLogout() instead.

See also

https://www.drupal.org/node/3379194

1 call to user_logout()
RestAuthenticationController::userLogout in core/modules/rest/src/Controller/RestAuthenticationController.php
Logs the user out.

File

core/modules/user/user.module, line 608

Code

function user_logout() : void {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal\\user\\LogoutFinalizer::finalizeLogout() instead. See https://www.drupal.org/node/3379194', E_USER_DEPRECATED);
  \Drupal::service(LogoutFinalizer::class)->finalizeLogout();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.