When I wrote this plugin, in early 2005, spam fighting was harsh, time consuming and painful. A few months later came the almighty Akismet. Until further notice, I consider this plugin deprecated.

A lot of people tend to close comments when a post gets old, either to avoid comments on old topics, or to avoid spam (since link spammers randomly target old posts). I think it is a bad habit, since it's very frustrating for a late visitor not to be able to write a comment, or ask a question, especially when the post has a "technical" flavor (about code or software, for example). Plus, plugins auto closing comments do it regardless of the activity on a post : there can be a discussion going on, but suddenly, because the post was written 15 days ago, discussion is shut off. Kind of rude.

I think it would be better to auto moderate, not close, old posts. I also think it would be smarter to consider activity on a thread, i.e. date of last comment if applicable, or modification, rather than the date it was written.

So I wrote a WordPress plugin : Auto Moderate Comments

How it works

Once installed and activated (see below), here is what the plugin does when someone posts a comment (or a trackback) to determine if this is Old Stuff® or not, and thus to accept the comment or send it to moderation queue :

Put the file in your plugins directory (yourblog/wp-content/plugins/) and activate it in the plugins admin interface.

Options and Tags

You can edit three variables at the beginning of the script, explained here with their default values

$ozh_moderate['max_age'] = 15
Maximum number of days since last activity to accept a comment, otherwise sent to moderation queue

$ozh_moderate['status_ok'] = "
Result printed by the template tagwp_ozh_automoderate_status (see below) when a post is still considered active (i.e. there has been some activity in the last $ozh_moderate['max_age'] days)
Default to empty string, but you can still make it "Your comment is welcome" if you want to make things clearer.

$ozh_moderate['status_moderated'] = "Please Note : Old stuff here… Therefore your comment on this post will be moderated (i.e. don't submit twice !)";
Result printed by the template tagwp_ozh_automoderate_status (see below) when a post is considered inactive (i.e. too old). I think it is a good thing to tell readers that their comment will be moderated.

The plugin creates a new template tag :

<?php wp_ozh_automoderate_status() ?>
You can for example Insert this tag in the comments template file :

You can also get the status of a post, instead of printing it. To do so, pass 0 (zero) as a parameter :<?php $status = wp_ozh_automoderate_status(0) ?>

Notes

Of course, use this plugin if, by default, you are not moderating comments and are accepting pingbacks and trackbacks (Discussion Options in the admin area, "Allow link notifications from other Weblogs" and "Allow People to post comments")

The plugin should not interfere with anti spam plugins. I am using Kitten's Spaminator here, and as far as I can see, all my plugin does regarding that matter is even catching a few spam that went through Spaminator.

The plugin should work on all versions of WordPress. To be honest I tested it only with 1.3 and 1.5 and was too lazy to set up a third installation with 1.2, but I see no reason why it wouldn't fit in 1.2 as well :-)
(By the way, you should upgrade to 1.5, but that is another story :)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar and sign for a free accountSpam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.

I love WordPress plugins so I wrote a book!

This site

This is planetOzh, weblog of Ozh, a 35 years old dude living in France with an interest for, errr, like, computer things. I have a wife, 2 kids, and one computer-unrelated job. Give my eye a gentle click to read more about me.