Don't Back Down

Posted by Chad Everett on July 14, 2004

MT-Moderate 0.4.0 »

I've talked (more than once) about a new plugin I've been working on for Movable Type-powered blogs.

I'm still not satisfied with it, mostly because it's not (easily) configurable and it's not readily apparent that it's working. But since I've been hit with a rash of comment spam in the last couple days (another 10 already today), and Jay's magnificent MT-Blacklist plugin isn't yet ready for version 3.0 (at least not in a form that is publicly available), I figured I would release it.

So without further ado: MT-Moderate.zip.

Version 0.4.0 is to be considered pre-release software. It works, and doesn't seem to break anything, but it's not fully developed. Primarily, I'd like it to send the 'approval required' email after automatically moderating comments, but because of the way callbacks work currently, I can't do that. So you'll still get a regular-looking comment notification email (if you have them enabled), and you'll have to go to your comments list to verify that it was indeed moderated and requires approval.

Simply place the Moderate.pl file in the plugins folder under your Movable Type installation directory, make sure the file is readable (permissions of 644 usually work fine) and you're set:

        MT_DIR/plugins/Moderate.pl

The plugin is currently hard-coded with certain parameters. Namely, that comments left on entries greater than 7 days old will require approval unless there is an already-approved comment on that entry that is less than 1 day old. If you'd like to change those values, you can find them near the bottom of the plugin code:

        $edated > 7000000 && $cdated > 1000000

The variable $edated is the entry date difference and the variable $cdated is the (most recently approved) comment date difference. Just change the number portion (7 or 1) to a value you'd like. Make sure you leave the zeros, as that indicates a day. If you remove zeros, you're working with values less than one day. You should have experience with Unix-style timestamps if you want to try this.

You are not required to have comment moderation turned on in order for this to work. In fact, the plugin is designed so that comment moderation should be turned off. Turning it on will mean that all your comments will require approval, and that's not the point.

If you use MT-Notifier, be aware that it will work fine with comment moderation, as long as you are using version 2.0 or greater. If you use Movable Type prior to version 3.0D, this plugin will do nothing for you. No additional Perl modules are required for MT-Moderate to work.

Update: Those 10 new comments? All were set to require approval.

Update: Current batting average: 45 for 46 (.978)!

Announcement. Download.

Related Entries

Comments (9)

Hi,

Great plugin! so I just put this plugin on my weblog directory and it looks work fine.

However, here's problem.

If user commented the entry which dated more than a week by using TypeKey ID, the comment automatically aproved but it will not come up on my site.

On my weblog preference, "Accept Comments from Registered Visitors" is checked. Also "Enable Auto-Approval" is checked. I have TypeKey token.

Do you know this problem? or maybe my configuration is wrong?
I just removed this plugin for a while, but I still wanted to use this plugin...

http://www.vjcatkick.com/blog/archives/200407/22-124000.php
this is my site (all in Japanese), but is introducing about "Moderate"...

MT-Moderate probably doesn't work in conjunction with TypeKey. I don't use it, so I didn't design it to do so. I'll take a look at it and see if I can include that into the Plugin.

I installed moderate last night and just got my latest batch of spam notification e-mails? I'm a little confused about how I deal with them - where do I go to approve or reject a comment?

Go into the Movable Type interface (where you go if you want to post a new entry, for instance). Look along the left side menu and go to "Comments". Once there, you'll see the comments on your blog. Approve those that are valid and delete the others.

Do remember that you're getting comment notifications regardless of whether the comment contains spam or not. Moderate doesn't know the difference. It only determines which comments to approve automatically, and that test is not based on the content of the comment - only the date!

Also, please make sure you have the latest version of the software, as it has been updated to work with TypeKey.

Hi I just installed your estimable plugin and it correctly distinguishes older entries from newer ones but when it detects an older one, it throws the comment to moderate status without displaying anything at all back to the user. If I moderate via the MT function, it uses the comment pending template and shows a message saying the comment will be displayed if approved. I'm not a Perl programmer so I don't know how to hack the plugin to do this. Is it even possible?

Yes, I understand the request. The short answer is that anything is possible. It's just a matter of making it happen. As of yet, I haven't done so. It isn't very high on my priority list. But it is on the list - I just need to figure out how to do it.

The problem is that I don't want to interrupt the flow, because I want the comment. I just want it to be moderated. So I need to interject a way to throw up the "pending" page. I may need to hack at more MT code to do so. Keep your eyes open. I'll post something when I figure out the best way to do it.

After actually looking at the comment code again (I hadn't done that for a while!), I remember why it was so low on my priority list.

MT-Moderate uses a callback to do its magic. This means you simply install the plugin and you are done.

The problem with this is that while the callback methods allow you to alter the data being saved, they do not allow you to alter the actual content being processed.

So while the correct value is saved to the database, it isn't used during processing the comment after the save takes place (and in turn, when the "pending" part is handled).

Six Apart has said that they will improve this handling in a future release, but it is, alas, not available yet. While MT-Moderate may change to provide this feature in the interim, it's not likely - far too much effort involved.

Thanks for looking at it - I think the dsbl plug may do it, I will peek at the perl for that one and see if I can find the code. I had to uninstall that plugin because it moderated every comment, so I don't have it anymore but will download it again.
If I want to change from 7 days to 10 or 14, do I just change 7000000 to 10000000 (ten plus six zeros)? Thanks!!!

Yes, that should do it.

Post a comment