You are here

public function ForcePasswordChangeService::getPendingUsersForRole in Force Password Change 2.0.x

Same name and namespace in other branches
  1. 8 src/Service/ForcePasswordChangeService.php \Drupal\force_password_change\Service\ForcePasswordChangeService::getPendingUsersForRole()

Retrieve the users with a pending forced password change in a given role.

Parameters

string $rid: The Role ID of the role in which users with a pending forced password change should be retrieved.

bool $countQuery: A boolean indicating whether to return the number of users, or the loaded user objects.

Return value

int|array If $countQuery is TRUE, the number of users in the role with a pending forced password change is returned. If $countQuery is FALSE, the loaded user objects of all users in the role who have a pending forced password change will be returned.

Overrides ForcePasswordChangeServiceInterface::getPendingUsersForRole

File

src/Service/ForcePasswordChangeService.php, line 183

Class

ForcePasswordChangeService

Namespace

Drupal\force_password_change\Service

Code

public function getPendingUsersForRole($rid, $countQuery = FALSE) {
  $rid = $rid == 'authenticated' ? FALSE : $rid;
  $uids = $this->mapper
    ->getPendingUserIds($rid);
  if ($countQuery) {
    return count($uids);
  }
  return $this
    ->userLoadMultiple($uids);
}