Answers.Body: <p>If you want to delete users (or any other elements in Craft) directly from the database, the place to do that is the <code>elements</code> table. Delete the row(s) from there, and all the elements’ rows in the other tables will go away automatically.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-21T06:18:06.110Z
Answers.Text: I want to delete a lot of "pending" users. I can't see where in craft_elements what is what. There isn't a column to differentiate them from "active" users?
Answers.UserDisplayName: Simon Clayson
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-24T08:40:43.090Z
Answers.Text: Not to worry, purgePendingUsersDuration seems to work great!
Answers.UserDisplayName: Simon Clayson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-16T01:33:37.547Z
Answers.Text: Is this still the case for 2020? Table `elements` or `elements_sites`. `craft_elements` does not exist.
Answers.UserDisplayName: Jessica Talzor
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-16T02:27:38.650Z
Answers.Text: @JessicaTalzor still valid, yes. You should definitely have an `elements` table (possibly prefixed with something depending on your `tablePrefix` setting).
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-14T12:04:00.557Z
Answers.Text: For anybody wondering, this still works in 2024!
Answers.UserDisplayName: Jamie Jenkins
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-07-16T22:59:48.573Z
Answers.LastActivityDate: 2020-03-16T02:26:59.230Z
Answers.LastEditDate: 2020-03-16T02:26:59.230Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>We have a client site that has been getting a lot of spam registrations. We're turning on <a href="http://buildwithcraft.com/docs/config-settings#purgePendingUsersDuration"><code>purgePendingUsersDuration</code></a> to help deal  with some of these automatically, but I was planning to go into the database to delete a bunch in bulk directly (since there are almost 200 of them)</p>
  
  <p>Is it safe to delete them just from <code>craft_users</code> and <code>craft_usergroups_users</code> tables? Are there other places I should watch out for?</p>
  
Tags: <users><database>
Title: Is it safe to mass delete users from the database directly
ThreadText: # Is it safe to mass delete users from the database directly
  
  (Asked by: username_0 on 2014-07-16)
  
  We have a client site that has been getting a lot of spam registrations. We're turning on [`purgePendingUsersDuration`](http://buildwithcraft.com/docs/config-settings#purgePendingUsersDuration) to help deal with some of these automatically, but I was planning to go into the database to delete a bunch in bulk directly (since there are almost 200 of them)
  
  Is it safe to delete them just from `craft_users` and `craft_usergroups_users` tables? Are there other places I should watch out for?
  
  **Tags:** users, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-16. Score: 9 | Accepted answer
  
  If you want to delete users (or any other elements in Craft) directly from the database, the place to do that is the `elements` table. Delete the row(s) from there, and all the elements’ rows in the other tables will go away automatically.
  
  > **Comments:**
  > **username_2**: I want to delete a lot of "pending" users. I can't see where in craft_elements what is what. There isn't a column to differentiate them from "active" users?  
  > **username_2**: Not to worry, purgePendingUsersDuration seems to work great!  
  > **username_3**: Is this still the case for 2020? Table `elements` or `elements_sites`. `craft_elements` does not exist.  
  > **username_1**: @username_3 still valid, yes. You should definitely have an `elements` table (possibly prefixed with something depending on your `tablePrefix` setting).  
  > **username_4**: For anybody wondering, this still works in 2024!  
  
  ---
  
  