function user_expire_process_per_user_expiration in User Expire 8
Same name and namespace in other branches
- 7 user_expire.module \user_expire_process_per_user_expiration()
Expires users who have an expiration that has passed.
1 call to user_expire_process_per_user_expiration()
- user_expire_cron in ./
user_expire.module - Implements hook_cron().
File
- ./
user_expire.module, line 192 - Main module file for User expire module.
Code
function user_expire_process_per_user_expiration() {
// Retrieve list of all users to be disabled.
$query = \Drupal::database()
->select('user_expire', 'ue');
$expired_users = $query
->condition('ue.expiration', \Drupal::time()
->getRequestTime(), '<=')
->fields('ue', [
'uid',
])
->execute()
->fetchCol();
$accounts = [];
foreach ($expired_users as $uid) {
$accounts[] = \Drupal::entityTypeManager()
->getStorage('user')
->load($uid);
}
user_expire_expire_users($accounts);
}