Best Method for Mass Deleting Splogs/Users

Just curious as to what everyone considers the best way to delete a whole bunch of splogs/users.

I have a wpmu 2.9.2 that was allowing open blogs/users to sign up and have a basic blog for free and upgrade for "supporter" benefits. It has sadly been neglected over the past 7-8 months and Is full of splog signups and users.

If I wanted to do a mass delete of all non-supporter blogs (the ones that aren't paying - cause truly, no non-paying blogs/users are legit on this site) how would I go about this?

Using the wp-admin interface only allows me to delete 20 at a time and I'm looking at thousands of blogs to be deleted. Is there a way to safely delete these blogs/users directly from the database?

  • drmike
    • DEV MAN’s Mascot

    Not in a position to work out the code for this but I would use the Upgrade Blogs strip already built in. Take a look at this file:

    and also version.php (where ever it is.) and the database version number in there. Depending on the database version number, that;'s how it;s determined which upgrade script gets run.

    edit: Version.php is here:

    db is currently 12329. Don;t do anything with that yet.

    Go back to the upgrade.php file and look at here:

    See how it checks against the version numbers? Find the end of that section and add in a new check. Like this:

    if ( $wp_current_db_version < 12350 )
    upgrade_evil spammers();

    The number checked against has got to be bigger than the current db version number but not as big as what's currently being used in 3.0.

    Write yourself a small function like the following:

    function upgrade_evil spammers() {
    global $wpdb;
    if !(is_supporter()) {

    Probably will need the current blog info in the global line as well.

    Something like that should work.

    May want to consider setting the blog to archived or something like that instead just in case you get a false positive.

    Hope this helps,

  • Mason
    • DEV MAN’s Sidekick

    Nice idea drmike!

    Pretty clever use of what's already built into WordPress.

    Good point about the core edit, but you could change it back once the "upgrade" process had finished or simply let it be over-written the next time you upgraded WordPress.

  • drmike
    • DEV MAN’s Mascot

    I; ve been half tempted to gut all of that actually as it;s not needed. We're on db 12k and we're doing checks against version 300? (The upgrade script gets run any time the admin accesses the blog's dashboard.)

    I forgot to mention. Aftre doing the 2 core edits, bump up the count to something like 12355, above what you;re checking for and then run the Upgrade Blogs script from the Dashboard.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.