Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DanLaufer/9242b11561a0be4e64c62a3ce855ac53 to your computer and use it in GitHub Desktop.
Save DanLaufer/9242b11561a0be4e64c62a3ce855ac53 to your computer and use it in GitHub Desktop.
Drupal 8 - EntityQuery to get Users with role programmatically
// Find all users with the Administrator role.
$admin_user_ids = \Drupal::entityQuery('user')
->condition('roles', 'Administrator', 'CONTAINS')
->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment