Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Listing authenticated users without roles

Parent Feed: 

1st Jul
2008

Sometimes we'd like to list users who have registered with a Drupal site, but haven't been placed into any proper roles yet via subscriptions, purchases, membership approval or whatever.

Try this join query to get started:


  1. SELECT users.uid, name, created, access, login, status

  2. FROM {users}

  3. LEFT OUTER JOIN {users_roles}

  4. ON users.uid = users_roles.uid

  5. WHERE users_roles.uid IS NULL AND users.uid != 0

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web