SSWI — When in doubt, buff it out.

Mass Delete for 1.5,

Written in Frisco, TX on March 3, 2005 and tagged with .

22 Comments, 0 Tweets, why not add one?

My Flickr Stream

Back in September of 2004 I released a plugin that allowed you to delete large amounts of spam with one click.

Some backstory

Basically one afternoon I was hit with a wave of spam that resulted in 1500+ comments awaiting moderation that were all spam.  That was not a fun prospect, deleting all of those comments via the admin UI.  So I took a trip to the terminal and issued one command, which wiped them all out.

So taking that experience I created a plugin that allowed you to delete comments by author, IP, email or URI.  Now fast forward to WordPress 1.5.  1.5 has some wonderful toosl to help you combat spam built in, a blacklist feature, moderation by keywords and so on.  At first I was stoked at how well these tools were working, I didn’t see any real waves of spam hitting my site, I was assuming that 1.5 was sending all that evil to /dev/null/ like a good little monkey.

I however, was very wrong.

Apparently the DEVs decided that what should happen is that anything that is considered spam will be flagged as such: ‘spam’ and kept in the comments table in all our databases.  I still fail to see the usefullness of this, but that was not my call.  The point is that I was in my DB mucking around, as I am want to do, and found that I had 1500+ “spam” comments just hanging around in my comments table, with no way to interact with them from within WP.  Now for me, that really isn’t a big deal, I just fire up the old terminal, or open phpMyAdmin and delete them that way.  For the normal user though, that is another story.

Enter Spam Nuke

spam nuker!

So I being the good samaritan I am, raised a feature request bug about this, and was basically told that you should just issue the "DELETE from wp_comments WHERE comment_approved = 'spam'"; which my friends is crap.  The normal user who cares about the size of thier DB should be able to easily and quickly get rid of that chaff from within WordPress.

Well now you can.

I had been meaning to update Mass Delete for 1.5 for some time.  This answer from the DEVs gave me the impetus I needed to get it done.  This new version serves two purposes:

Getting to the features

You can still delete groups of spam as you did originally, only now Mass Delete only deletes from comments flagged as spam, when you are successful you see this message:

nuke some

The new feature is Mass Nuke, with one click you can nuke every comment in your table that is flagged as spam, when run successfully you see this message:

nuke em all!

Not really much to it, really.  Once the plugin is activated you can find it in the Manage submenu, there will be a selection labeled Spam at the end.

Here is the file you need cjd_delete.zip.  Enjoy and let me know if you find any bugs, or have any comments.

If you post about this on Twitter, please use the hashtag #silly449.


personal avatar

andrena, on March 1, 2007

Thank you so much! Until I stumbled upon your site, I didn’t have a clue that all the spam was in my database (duh!!!) Thank you again! :-)

personal avatar

patrick, on March 1, 2007

Worked great; thanks!

personal avatar

Micah, on March 1, 2007

This is the single best WP plug-in I’ve ever downloaded. Thanks for doing this.

personal avatar

pericat, on March 1, 2007

Lovely! And much less of a chore than remembering to ssh out to my host and do SQL things.

Thanks for this, as well as your many other fine contributions that make my life easier.

personal avatar

Chris J. Davis, on March 1, 2007

No, that should read as it does,

Be warned this is undoable.”

And as for the sorting, I am fairly confident that a valid commenter will be showing up in singles, not in multiples.

But I have been investigating how to modify the code to allow for differing sorts.

personal avatar

Anton Sherwood, on March 1, 2007

There appears to be a small error in the text:
“Be warned this is [missing word?] undoable …”

personal avatar

Anton Sherwood, on March 1, 2007

Or possibly:
tr '\r' '\n' <cjd_delete.php >cjd_delete.php.unix; mv cjd_delete.php.unix cjd_delete.php

personal avatar

Anton Sherwood, on March 1, 2007

Thanks!

The Unspam menu would be easier to use if it could be sorted by a column other than IP.

personal avatar

Tim Hardy, on March 1, 2007

Great plug-in, thank you! Worth it for the “unmark as spam” option alone.

This didn’t work out of the box for me when I unzipped it under linux. The “Enable plugins” screen became garbled with the contents of the raw php file. I’m guessing this is because you developed this on a Mac which handles endline characters differently.

If anyone other linux user is having the same problem, the following converts the code to unix format:
tr '\r' '\n' cjd_delete.php.unix && mv cjd_delete.php.unix cjd_delete.php

Hope this helps a few more linux newbies enjoy the fruits of your work!

personal avatar

Tim Hardy, on March 1, 2007

Anton is correct - apologies for the typo above in which I’ve somehow missed out a vital chunk of the command sequence. Thanks for correcting this.

personal avatar

Anton Sherwood, on March 1, 2007

Oh. How is it undoable? (And why the warning?)

Yes, a valid commenter is likely to be unique, and thus harder to spot if the sorting is effectively random. Each dummy domain tends to occupy several rows of the table with different IPs; the false positive does not stand out.

If the table were sorted on the name, it would be easier to find the one whose name is not some variant of “poker”. If it were sorted on the URL, it would be easier to find the one that is not in a “dummy domain of the day”.

personal avatar

Jo, on March 1, 2007

Excellent! Thank you so much - had no idea those peskie lumps of spam were still hanging around

All nuked!!

:)

personal avatar

Logan, on March 1, 2007

Excellent plugin. I didn’t even know that those little spam-spawn were still in my database. Thanks!

personal avatar

Michael Sarver, on March 1, 2007

Much like many of the others said, I had no idea that when I marked a comment as “spam” it was still chillin’ in my DB. Thanks for the plug-in! I like order…

personal avatar

Oli, on March 1, 2007

3333 spam comments in my db counts PHPadmin. One click with ur great Plugin and they all gone to nirvana.
Thx a lot from a german user

personal avatar

Static Brain, on March 1, 2007

Very handy little tool. Thanks for it. I hate spam and any invention to make it go away easier is dearly loved. :-)

personal avatar

Natasha, on March 1, 2007

Wow! I’ve just installed this. I’ve just recently started getting stupid spam comments from online poker and all that shiznay, and phpadmin is a bit screwwy on my computer. Thank you for making this, I’m a bit of a newbie, so this is UBERhelpful!

personal avatar

Jonathan, on March 1, 2007

I take it this works OK with Wordpress 2.0.x? I hope so as I’ve just nuked 45 spam comments with it! I really don’t want those cluttering up my database. Thanks for the plugin.

personal avatar

Andy, on March 1, 2007

I just wanted to say thank you for a brilliant plugin. Effective, simple, easy to install and make use of.

personal avatar

Whitesox, on March 1, 2007

Absolutely gorgeous plugin……

personal avatar

Gloups, on March 1, 2007

Thank you for this plugin. I’m sure it will help me !!

(Sorry for my bad english : I’m french :-p)

personal avatar

bill, on March 1, 2007

I keep getting this error when trying to delete all spam comments:

Cannot load cjd_delete.php