You are here

public function AdminContentNotificationService::getUsersOfRoles in Admin Content Notification 8.3

Get users of roles.

Return value

array Array of User Uids.

1 call to AdminContentNotificationService::getUsersOfRoles()
AdminContentNotificationService::sendMail in src/AdminContentNotificationService.php
Send Eamil.

File

src/AdminContentNotificationService.php, line 84

Class

AdminContentNotificationService
AdminContentNotificationService implement helper service class.

Namespace

Drupal\admin_content_notification

Code

public function getUsersOfRoles($roles) {
  $ids = \Drupal::entityQuery('user')
    ->condition('status', 1)
    ->condition('roles', $roles, 'IN')
    ->execute();
  if (in_array('authenticated', $roles)) {
    $ids_authenticated = \Drupal::entityQuery('user')
      ->condition('status', 1)
      ->execute();
    $ids = array_unique(array_merge($ids, $ids_authenticated));
  }
  return $ids;
}