In: , , , ,
On: 2005 / 02 / 02
Shorter URL for this post: http://ozh.in/49
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 :

  • Compare today's date with date of last comment
  • If no comments, compare today's date with post's modification date
  • If never modified, compare today's date with writing date

Install

Get the plugin here :

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 tag wp_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 tag wp_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 :

  • WordPress 1.2 / 1.3 : blogroot/wp-comments.php
  • WordPress 1.5 : blogroot/wp-content/themes/yourtheme or default/comments.php

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 :)

Shorter URL

Want to share or tweet this post? Please use this short URL: http://ozh.in/49

Metastuff

This entry "WordPress Plugin : Auto Moderate Comments" was posted on 02/02/2005 at 4:16 pm and is tagged with , , , ,
Watch this discussion : Comments RSS 2.0.

52 Blablas

  1. Nice submit! GA can be my greatest earning. On the other hand, it’s not a much.
    thanks !! quite useful submit!
    amazing things thanx

  2. Gurdit says:

    I would love if you would update this plugin to be completely suitable for WordPress 3.1+

    I don't want to close comments on my old posts, but lately, I've been getting more spam on my old comments. I would like to send them to moderation queue and then decide what to do with them later.

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 account
Spam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.

Read more ?