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

Related posts

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. You can trackback this post from your own site

49 Blablas

    Pages: « 1 2 [3] Show All

  1. 41
    Ozh France »
    commented, on 02/Mar/06 at 7:11 pm # :

    Steve » yes, I noticed that too when I began starting using Akismet. To be honest I didn’t look further after the problem (probably a simple plugin priority level) since it seems that my plugin is deprecated now that Akismet is around and handles spam wonderfully.

  2. 42
    Steve Europe »
    replied, on 03/Mar/06 at 12:13 pm # :

    Well was a nice plugin anyway… but for span Akismet do it’s work flawlessy then i understand your choice :)

  3. 43
    Doe Niet Zo Moeilijk! Netherlands »
    trackback on 05/Mar/06 at 10:28 pm # :

    Zondagavondverzamelpost

    Terugblik en bezinning aan het einde van de week. Ofzo.

  4. 44
    Chari United States »
    wrote, on 11/Apr/06 at 6:51 pm # :

    Is there a way to have it email the admin that a comment is awaiting moderation? It hasn’t done that, so I don’t know if it’s supposed to, or if something is wonky with my blog. Thanks!

  5. 45
    hinter den kulissen - [ jan | ogisch ] =... Germany »
    pingback on 09/Jul/07 at 8:02 pm # :

    [...] das zu alten themen kommentiert werden kann … das hier kein unsinn passiert ist mit dem automatischem moderieren von alten beiträgen erreicht und hashcash sorgt dafür das nicht mehr durchkommt … [...]

  6. 46
    links for 2007-07-26 China »
    pingback on 26/Jul/07 at 8:27 am # :

    [...] Wordpress Plugin : Better Feed « planetOzh (tags: wordpress) [...]

  7. 47
    WP插件:Auto Moderate Comments-... United States »
    pingback on 09/Oct/07 at 1:22 pm # :

    [...] WP官方下载页面 | 插件作者下载页面 [...]

  8. 48
    bushtool United States »
    replied, on 18/Nov/07 at 6:32 pm # :

    Great plugin, just what I needed to stop spam comments that sneak through akismet and go to my comment subcribers. Thanks very much.

  9. 49
    Jenn United States »
    said, on 28/Dec/07 at 8:34 am # :

    This is a really awesome plugin. I’m wondering if there is any way it can be modified to auto moderate comments on a post by post basis? Rather than moderate comments on a post that is X days old, moderate comments on a post that I want them to be moderated on? I’m thinking of an option that would show up in the writing area, something along the lines of an option saying “auto moderate comments for this post?” with a checkbox beside it.

    I’d be happy to make a Paypal donation in exchange for a modification like that. :)

Pages: « 1 2 [3] 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 ?

Close
E-mail It