Ask Dave Taylor
  • Facebook
  • Instagram
  • Linkedin
  • Pinterest
  • Twitter
  • YouTube
  • Home
  • YouTube Videos
  • Top Categories
  • Subscribe via Email
  • Ask A Question
  • Meet Dave
  • Home
  • HTML & Web Page Design
  • How can I delete Movable Type (MT) blog comment spam easily?

How can I delete Movable Type (MT) blog comment spam easily?

November 18, 2004 / Dave Taylor / HTML & Web Page Design, Wordpress Help / 8 Comments

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!

About the Author: Dave Taylor has been involved with the online world since the early days of the Internet. Author of over 20 technical books, he runs the popular AskDaveTaylor.com tech help site. You can also find his gadget reviews on YouTube and chat with him on Twitter as @DaveTaylor.

Let’s Stay In Touch!

Never miss a single article, review or tutorial here on AskDaveTaylor, sign up for my fun weekly newsletter!
Name: 
Your email address:*
Please enter all required fields
Correct invalid entries
No spam, ever. Promise. Powered by FeedBlitz
Please choose a color:
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

8 comments on “How can I delete Movable Type (MT) blog comment spam easily?”

  1. Rajiv Kumar says:
    October 3, 2008 at 1:12 pm

    Actually i am unable to post comments without login
    Please Help me Out

    Reply
  2. Nicholas Barnard says:
    November 27, 2007 at 6:01 pm

    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.

    Reply
  3. Mark C. says:
    April 25, 2006 at 1:12 am

    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.

    Reply
  4. Lockergnome's Web Developers says:
    January 19, 2005 at 2:32 am

    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…

    Reply
  5. Dave Taylor says:
    November 19, 2004 at 7:08 am

    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. 😐

    Reply
  6. Nick says:
    November 18, 2004 at 2:52 pm

    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

    Reply
  7. Dave Taylor says:
    November 18, 2004 at 4:46 am

    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…

    Reply
  8. Sean says:
    November 18, 2004 at 4:03 am

    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

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Recent Posts

  • How Can I Share My Netflix Account With My Friend? [Updated for 2023]
  • How to Check Energy Recommendations on your Windows Laptop
  • How Do I Customize New Tab Windows in Safari for Mac?
  • Can AI-Generated ChatGPT Text Be Accurately Identified?
  • How to Perform a Microsoft Account Security Audit and Checkup

On Our YouTube Channel

How to: Replace a Switchbot Door Sensor Battery

EMEET Luna vs INNOTRIK Studio Bluetooth Speakerphones -- DEMOS & REVIEW

Categories

  • AdSense, AdWords, and PPC Help (106)
  • Amazon, eBay, and Online Shopping Help (163)
  • Android Help (226)
  • Apple iPad Help (147)
  • Apple Watch Help (53)
  • Articles, Tutorials, and Reviews (346)
  • Auto Tech Help (15)
  • Business Advice (200)
  • ChromeOS Help (31)
  • Computer & Internet Basics (779)
  • d) None of the Above (166)
  • Facebook Help (383)
  • Google, Chrome & Gmail Help (188)
  • HTML & Web Page Design (247)
  • Instagram Help (49)
  • iPhone & iOS Help (623)
  • iPod & MP3 Player Help (173)
  • Kindle & Nook Help (99)
  • LinkedIn Help (88)
  • Linux Help (173)
  • Linux Shell Script Programming (89)
  • Mac & MacOS Help (911)
  • Most Popular (16)
  • Outlook & Office 365 Help (33)
  • PayPal Help (68)
  • Pinterest Help (54)
  • Reddit Help (19)
  • SEO & Marketing (82)
  • Spam, Scams & Security (95)
  • Trade Show News & Updates (23)
  • Twitter Help (220)
  • Video Game Tips (66)
  • Web Site Traffic Tips (62)
  • Windows PC Help (947)
  • Wordpress Help (206)
  • Writing and Publishing (72)
  • YouTube Help (47)
  • YouTube Video Reviews (159)
  • Zoom, Skype & Video Chat Help (62)

Archives

Social Connections:

Ask Dave Taylor


Follow Me on Pinterest
Follow me on Twitter
Follow me on LinkedIn
Follow me on Instagram


AskDaveTaylor on Facebook



microsoft insider mvp


This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to our terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. Our lawyer says "Thanks for your cooperation."
© 2023 by Dave Taylor. "Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.
Privacy Policy - Terms and Conditions - Accessibility Policy