[support] Help with deleting all users with a specific role

Fred Jones fredthejonester at gmail.com
Thu Mar 12 19:41:45 UTC 2009


> excellent thankyou.  I assume i can create a page with php input, and select
> users by role with a form.

  $drupal_sql = 'select users.uid from {users} left join {users_roles} on
                 users.uid = users_roles.uid
                where rid=4 '; // where 4 is your role
  $r = db_query($drupal_sql);
  while ($row = db_fetch_array($r)) {
     user_delete($row->uid);
  }

Sumthin' like that.


More information about the support mailing list