
How can I delete Movable Type (MT) blog comment spam easily?
A technical wizard pal of mine asks: "I have all sorts of challenge/response barriers to comment spam on my Movable Type weblog, but occasionally someone goes through the work of identifying themselves and still leaves some silly spam comment. I want to delete it, but right now I get the email notification of the new comment, then have to log in to the administrative interface, find the comment, and delete it by hand. Quite a hassle. Isn't there a better solution to this?"
Ah yes, those wonderful people with their blogspam comments on weblogs. A personal message from Ask Dave Taylor about this type of comment: Keep it off our site!
I feel better now. Thanks for letting me vent. To make life easier for me, I hacked into the Comments.pm module within Movable Type (which you can find in lib/MT/App in your installation) and made the following addition: $body .= "\nDelete:" .
$app->{cfg}->CGIPath .
"mt.cgi?__mode=delete_confirm&" .
"_type=comment&id=".$comment->id .
"&blog_id=" . $blog->id . "\n";
This should be placed immediately after the message construction line:$body = Text::Wrap::wrap('', '', $body) . "\n$link_url\n\n" .
$app->translate('IP Address:') . ' ' . $comment->ip . "\n" .
$app->translate('Name:') . ' ' . $comment->author . "\n" .
$app->translate('Email Address:') . ' ' . $comment->email . "\n" .
$app->translate('URL:') . ' ' . $comment->url . "\n\n" .
$app->translate('Comments:') . "\n\n" . $comment->text . "\n";
Now, when I get notification of a new comment, I have an instant "Delete" link I can click, which then takes me directly to the confirm dialog box (though in a big browser window, which is kinda weird). I click "delete" a second time, and the comment is wiped out of the database.
However, and this is an important caveat, I still need to rebuild the weblog to finish the removal process. Not a big deal: I usually find myself rebuilding every 2-3 days anyway, but unfortunately I haven't figured out how to do everything with a single mouse click. Yet. If you know of other ways to build a URL to embed in the email notification that offers a one-click delete comment and rebuild weblog as needed feature, I'd sure love to hear about it!
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.
Categorized:
Blogs and RSS Feeds
, CGI Scripts and Web Site Programming
(Article 3768)
Tagged: Previous: Can yaboot support three OS choices for Linuxes and Mac OS X? Next: How do I add new "ping" sites to a Movable Type Blog? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. I use MT-Blacklist. While it lets through a fair bit of spam, it provides a great interface to bulk delete comments, including rebuilding all the relevent pages. BTW, how did you get that math question in there? Does it work well? I was going to hack it into mt-comments.cgi, but I see a few people have similar schemes so I thought there might be something out there. Sean Posted by: Sean at November 18, 2004 4:03 AMThanks for your note, Sean. MT-Blacklist is something that only comes along with an upgraded version of Movable Type: I'm still running 2.x so I can't use it. I am, however, starting to think about an upgrade. :-) In terms of the math formula, I paid someone to write a custom plug-in for me and then added some code both in the comment templates and in the Comments.pm module... Posted by: Dave Taylor at November 18, 2004 4:46 AMYou can actually use the earlier versions of MT-Blacklist on a 2.X MT blog. It's not as advanced, and the blacklist isn't being updated, but I still find it useful for those situations in which I get 300 identical spam comments, all on different entries. I can click the link in the notification email, delete the comment and rebuild that one entry, then "de-spam" the whole blog and rebuild the relevant entries in one step. And I agree; the math formula is terrific! Does it actually cut down on the amount of comment spam? If it does, maybe you'll take a contribution towards costs to share it ...? ---- Nick Posted by: Nick at November 18, 2004 2:52 PMI get almost zero comment spam, actually. It's a rare occurrence, probably less than six/month at this point (I cringe at even writing this, though). However, I'm a pretty open source sort of guy, but I am not willing to share this particular plug-in for the simple reason that the more sites that use it, the more motivation spammers will have for figuring out how to reverse-engineer it. Sorry. :-| Posted by: Dave Taylor at November 19, 2004 7:08 AMCan someone elaborate on what comment spam is all about? I'll come back to see if there's a clarification later this week. Thanks. Posted by: Mark C. at April 25, 2006 1:12 AMHere's how to do it in one click. First you have to have Jay Allen's MT-Blacklist installed http://www.jayallen.org/projects/mt-blacklist/ Then instead of the code in the Comments.pm file, add the following in the same place: Then in your MovableType directory drop this file as commentremove.cgi (you'll probably need to edit the action= path to mt-blacklist.cgi) #!/bin/sh echo Content-type: text/html; charset=utf-8 echo \<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"\>
I have a lot to say, but ...
I do have a comment, now that you mention it!
|
Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|