5

We have a client site that has been getting a lot of spam registrations. We're turning on 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?

1 Answer 1

9

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.

5
  • 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? Commented Oct 21, 2014 at 6:18
  • 1
    Not to worry, purgePendingUsersDuration seems to work great! Commented Oct 24, 2014 at 8:40
  • Is this still the case for 2020? Table elements or elements_sites. craft_elements does not exist. Commented Mar 16, 2020 at 1:33
  • 2
    @JessicaTalzor still valid, yes. You should definitely have an elements table (possibly prefixed with something depending on your tablePrefix setting). Commented Mar 16, 2020 at 2:27
  • For anybody wondering, this still works in 2024! Commented Feb 14 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.