You are here

function mass_pwreset_get_uids in Mass Password Reset 8

Same name and namespace in other branches
  1. 2.x mass_pwreset.module \mass_pwreset_get_uids()

Return uids for all user accounts.

Excludes uid 0, 1, and current uid.

1 call to mass_pwreset_get_uids()
MassPasswordResetForm::validateForm in src/Form/MassPasswordResetForm.php
Form validation handler.

File

./mass_pwreset.module, line 61
Reset user passwords and optionally notify users.

Code

function mass_pwreset_get_uids() {

  // Do not include current logged in user.
  $current_uid = \Drupal::currentUser()
    ->id();
  $db = \Drupal::database();
  $query = $db
    ->select('users', 'u');
  $query
    ->fields('u', [
    'uid',
  ]);
  $query
    ->condition('u.uid', [
    0,
    1,
    $current_uid,
  ], 'NOT IN');
  $query
    ->orderBy('u.uid');
  $query
    ->distinct();
  return $query
    ->execute()
    ->fetchCol();
}