Skip to content

Instantly share code, notes, and snippets.

@shadcn
Created January 15, 2014 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadcn/8441724 to your computer and use it in GitHub Desktop.
Save shadcn/8441724 to your computer and use it in GitHub Desktop.
Drupal: function to find users with only authenticated role.
<?php
/**
* Helper function to find users with authenticated role only.
*/
function _users_with_authenticated_role_only() {
return db_query('SELECT uid, name, mail FROM users u WHERE uid > 0 AND NOT EXISTS (SELECT 1 from users_roles ur WHERE u.uid = ur.uid)')->fetchAll();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment