Skip to:

Deleting 53000 Spam inactive users

  • dccs52



    Currently inherited a website which has a terrible spam issue with BP.

    Simply put no measures were taken so it ran rampant. I have sorted this, but am now left with a very bloated DB.

    Having used

    SELECT * FROM wp_signups WHERE active = 0;

    I get the list of all inactive users.

    From here could some suggest the best way to remove all the data attributed to these inactive spam users?

    It boggles me that there isn’t something online.

    The reason i ask is i note the usermeta table is bloated along with the wp_signups, so i assume there is some relationship data in there, which ideally needs to go along with the inactive spam signups.

    Any guidance appreciated.

    And yes all is backed-up.

Viewing 5 replies - 1 through 5 (of 5 total)

  • shanebp


    Deleting users from wp-admin > Users will remove the user and postmeta, and entries in any BP tables that exist.

    But deleting 53000 users that way is not feasible.

    I suggest writing a function that gathers all or some of the user ids and then run deletes for each ID, targeting the appropriate tables.
    You’ll probably need to run batches in order to avoid time-outs.



    Thanks for the heads up

    Although surely from the age of BP this exists already?

    I can’t find anything at all. All posts are just dead ends as no one ever offers a way to do this.

    Granted I need to do this myself, for sure, just thought someone on this forum would have posted a solution already?



    I’m not aware of anything.
    Your report is maybe the second time I’ve heard of the issue with such a large number.
    If you write a custom function, create github gist. Perhaps it will help others or people will comment with optimize suggestions.



    @dccs52 You can also try after creating DB backup.
    it has the following options
    Delete users based on user role
    Delete users based on user meta fields
    Delete users who have not logged in in the last X days
    Delete users based on their registered date



    Yes, that plugin will help, but afaik it does not touch BP tables.
    This plugin may be helpful in that regard.

    You probably know this already:
    -setup a dev site
    -run your function against that db
    -you could also try running delete queries directly in phpmyadmin, if available

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar