Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. user.api.php

function hook_user_logout

The user just logged out.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user object on which the operation was just performed.

Related topics

Hooks
Define functions that alter the behavior of Drupal core.
1 invocation of hook_user_logout()
user_logout in core/modules/user/user.module
Logs the current user out.

File

core/modules/user/user.api.php, line 170

Code

function hook_user_logout(AccountInterface $account) {
    \Drupal::database()->insert('logouts')
        ->fields([
        'uid' => $account->id(),
        'time' => time(),
    ])
        ->execute();
}
RSS feed
Powered by Drupal