Upgrade Your Drupal Skills

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

See Advanced Courses NAH, I know Enough

Drush "user-list" Command

A simple task: list all the users on a site, optionally filtering by role or by status. Difficulty: using drush.

I had searched around a bit for this functionality and my Google-fu had failed me, so I decided to build off of work that already had been done and write a drush user-list command. (The internal monologue went something like this: "Is this a thing? It doesn't look like this is a thing. This should be a thing. Why is this not a thing? Let's make this a thing.")

Installation

Download user_list from Github or drupal.org and place it where you place the rest of your drush commands (e.g., in ~/.drush/ or /usr/share/drush/commands/)

Use

drush user-list

Returns a table of all users on the site.

drush user-list --status=active

Returns a table of all active users on the site.

drush user-list --roles="administrator,site owner"

Returns a table of all users with the role "administrator" or "site owner" on the site.

That's pretty much it.

Categories: 

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