You are here

function user_expire_user_load in User Expire 8

Same name and namespace in other branches
  1. 7 user_expire.module \user_expire_user_load()

Implements hook_user_load().

File

./user_expire.module, line 39
Main module file for User expire module.

Code

function user_expire_user_load($users) {
  foreach ($users as $uid => $user) {
    $query = \Drupal::database()
      ->select('user_expire', 'ue');
    $expiration = $query
      ->condition('ue.uid', $uid)
      ->fields('ue', [
      'expiration',
    ])
      ->execute()
      ->fetchField();
    if (!empty($expiration)) {
      $user->expiration = $expiration;
    }
  }
}