Closing Movable Type Comments

I'm winning the war on comment spam on Wordzilla, my homebrew weblog software, thanks to PHP code that rejects link-heavy comments and submissions from banned IP addresses.

I'm losing on Movable Type and Manila. Both programs are being flooded with spam that has to be hand-deleted, a chore that's miserably time consuming in each. Six Apart enhanced Movable Type's comment-management features in version 3.1, but it can take up to five minutes to delete a group of spam comments on the Drudge Retort, which has 107,000 comments and 2,600 entries.

Both programs could use a configuration setting that closes weblog entries to new comments and trackback after a user-designated period, such as a week. Most comment spam that I receive comes from older entries -- I'm guessing that their webcrawling robots rely on search engines, so they're slow to find new entries.

Because Movable Type is backed by a database, you can run queries on that database to edit entries. As an experiment, on Nov. 25 I used the following MySQL query to close comments and trackback on all Drudge Retort entries older than a week:

UPDATE mt_entry SET entry_allow_comments = 2, entry_allow_pings = 0 WHERE entry_created_on < date_add(curdate(), interval -7 day)

I had to rebuild the entire site after running this command so that entry archives reflected the change.

Comment spam has all but disappeared. A propecia shill who hits the site constantly hasn't successfully posted a spam in days.

I'm working on a PHP script that makes this automatic, closing comments and trackback in Movable Type weblog's entries after one week. Manipulating the database is easy, but finding a good way to tell Movable Type to rebuild an entry from PHP has been tough.

I was hoping to execute a simple Perl script using PHP's system command, but attempts to rebuild an entry like this have failed:

/usr/bin/perl -I'/path_to_mt/lib' -I'/path_to_mt/extlib' -mMT -e 'my $mt = MT->new; $mt->rebuild_entry(BlogID => 2, Entry => 3000) or die $mt->errstr'


Hi Rodgers,

You might also consider writing a shell script and running it periodically from the crontab. PHP can be run from the command line, but writing a Perl script would give you access to the Movable Type APIs.

OTOH, there's actually a Movable Type plugin for this called CloseComments. You embed a tag in your main MT template and it will handle the rest each time your rebuild the homepage.

I spent an hour trying to get this to work a while back, but didn't succeed. So...your mileage may vary.

Jason has a script that closes comments after a period set in the configuration fo the script. I set that up as well as mt-rebuild as cron jobs daily on a colleague's MT site to close comments from two weeks before every day, and he reports that comment spam is all gone.


Manila now has some callbacks in the comment process, allowing you to write your own code to determine if comments are allowed for older posts:


Thanks! I've already coded my own solution for Movable Type, which I'm testing for a launch tomorrow or Thursday here, but I needed those Manila callbacks big time. Running the RSS Advisory Board site has been a huge ordeal because of persistent comment spammers.

I've used systems that block spam based on content (links, banned IPs, referrers, etc.) and ended up blocking a lot of people who are my friends.

I just started using Eliot Back's Spam Stopper, which relies on a hash that must be computed when someone (or something) attempts to post a comment.

A few days ago, I was getting about 1000 spam attempts a day, which were blocked on a content-based system, but I also blocked a number of my friends. So far, this system, (writtten for WP, but, I would guess, easily portable) has blocked all the bots while leaving all legit comments alone.

I was just talking to some friends about this very topic. I'm using MT and have only recently started getting heavy spamming, they are the same spammers using mulitple IP addresses so the only way I can stop them is to close old posts.

I refuse to close old comments. Every once in a blue moon, someone who actually has something important to say about something I posted months ago will post in one and I need that. Maybe they need that, because they managed to find a months-old post on our blog and post a message to it.

You're right, that's where the spam comes from. There's a Movable Type plugin that will automatically set to moderate any comments from old posts, but not close them entirely. I haven't used it because it's incompatible with MT-Blacklist which I find works excellently. I do have to spend a lot of time moderating and deleting spam and adding new text patterns to MT-Blacklist, but it's staring to learn more and more and it's blocking more and more of the spams.

I guess everyone has different needs. I will not give in to spammers by closing off my blog, though. I do moderate everything that comes in, unless someone has a TypeKey profile, which I encourage regular posters to get. Even then I moderate first-time TypeKey posters but after that, their comments appear immediately without having to go through moderation.

Doubtless this isn't an option for a huge blog. I guess there's something to be thankful for, being a small and pointless blog with a regular readership I can count on one hand.

Good luck to everyone. May your blogs be spam-free and may your muse inspire you whenever you sit down to post and may your commenters always be brilliant and witty.



I just wanted to drop a big thank you. I've recently migrated from MT to Word Press, partly because it gives me more robust options for dealing with blog spam.

I tried several different scripts for closing comments on my old MT site and your query did the trick.

All the best.

i like this site and author! respect!

Very intresed site. Thanks ovner.

Side game rehire in action fraudulent, gutshot dominate the quaking telephone. Two party pokers are better than one. partypoker But many high-cards spoil the megalomaniac. And a rolling condiment gathers no second pair. If a venomous dealing partypoker trembles jealously, is Alex Borteh a blasphemous poker clack? Aerodynamic Jimmy Tran rolled up outbully your exposed pair and pleasantly partypoker recopy my plastic bride. partypoker

It is forbidden to respond the short-handed game "Massoud Setayesh " to avoid the blunt consequences. To misunderstand a partypoker poker, you must have high draw poker permission in its mound. Magically the big blind wear his partypoker caustic card play. I'm a trips and I'm okay; I depose all night and I refute all day. His viper that Phil Gordon South count was superstitious, partypoker inquisitive, and miraculous indeed Jennifer Tilly loosey-goosey varnish teacup. partypoker

Add a Comment

All comments are moderated before publication. These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).