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:
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!
Actually i am unable to post comments without login
Please Help me Out
Here’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:
$body .= “\nDelete: ” . $app->{cfg}->CGIPath.”commentremove.cgi?”.$comment->id.”\n”;
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
echo \<!DOCTYPE html PUBLIC \”-//W3C//DTD XHTML 1.0 Transitional//EN\” \”http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\”\>
echo \<html xmlns=\”http://www.w3.org/1999/xhtml\” lang=\”en\” xml:lang=\”en\”\>
echo \<head\>
echo \<title\>Delete Comment $QUERY_STRING \</title\>
echo \</head\>
echo \<body onLoad=\”javascript:submitform\(\)\”\>
echo \<script language=\”JavaScript\”\>
echo function submitform\(\)
echo \{
echo setTimeout\(\”document.onlyform.submit\(\)\”,45000\)\;
echo \}
echo \</script\>
echo \<div align=\”center\”\>
echo \<form method=\”post\” action=\”/mt/mt-blacklist.cgi\” name=\”onlyform\” enctype=\”application/x-www-form-urlencoded\”\>
echo \<input type=\”hidden\” name=\”__mode\” value=\”despam_multi\” /\>
echo \<input type=\”hidden\” name=\”_type\” value=\”comment\” /\>
echo \<input type=\”hidden\” name=\”deleteObject\” value=\”$QUERY_STRING\” /\>
echo \<input type=\”hidden\” name=\”rebuildEntries\” value=\”1\” /\>
echo \<input type=\”submit\” name=\”\” value=\”Delete Comment $QUERY_STRING\” /\>
echo \</form\>
echo \</div\>
echo \</body\>
echo \</html\>
And that is how you get comment removal and rebuilding in one click.
Can someone elaborate on what comment spam is all about? I’ll come back to see if there’s a clarification later this week. Thanks.
Google, Yahoo and MSN support “nofollow”? What’s that?
Dave, I was reading this evening that there’s a new HTML tag in town called “nofollow” and that it’s supposed to prevent weblog spam somehow? Can you explain what it’s about and how it can possibly help prevent spam…
I 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. 😐
You 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
Thanks 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…
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