In: , , , ,
On: 2005 / 02 / 02 Viewed: 84864 times
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

    Pages: « 1 [2] Show All

  1. 51
    Frank Altomari United States »
    wrote, on 21/Jan/11 at 3:53 pm # :

    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. 52
    Gurdit India »
    commented, on 22/Apr/11 at 8:20 am # :

    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.

Pages: « 1 [2] Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Read more ?