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

  1. 1
    Blogging Pro - Blogging News, Tools and ... United States »
    pingback on 05/Feb/05 at 7:04 pm # :

    &nbsp; This plugin is similar to Auto Shutdown but once installed and activated, the Auto Moderate plugin determines if a new comments o [...]

  2. 2
    AnthonyFinucane.com &raquo; Blog Arc... Hong Kong »
    pingback on 07/Feb/05 at 10:45 pm # :

    So, to try and help curb the influx of crap that is comment spam I&#8217;ve installed the Auto Moderate Comments plugin. It automatically add [...]

  3. 3
    Woordenaar | Archief » Goed ge... Netherlands »
    pingback on 16/Mar/05 at 2:35 pm # :

    [...] Zoiets is vast in een WordPress plugin gestopt (want geen standaard oplossing), en ja hoor Auto Moderate Comments is als plugin verkrijgbaar. [...]

  4. 4
    All Narfed Up » Blog Archive &r... United States »
    pingback on 23/Mar/05 at 7:57 am # :

    [...] sed after a certain period of time any longer, merely moderated after two weeks, thanks to Auto Moderate Comments. Hopefully, I’ll just [...]

  5. 5
    Binary Bonsai » Archive »... United States »
    pingback on 10/Apr/05 at 11:51 am # :

    [...] lled back to the WordPress default search. It’s crappy, but at least it works. Implemented Auto Moderate Comments instead of Optional Comment [...]

  6. 6
    Brian Meidell’s Blog » Remov... Denmark »
    pingback on 10/Apr/05 at 3:29 pm # :

    [...] or several days. I have taken Michaels advice and have now removed Spaminator and now use Auto Moderate Comments instead. [...]

  7. 7
    somefoolwitha.com » Sandbox gettin... United States »
    pingback on 10/Apr/05 at 6:53 pm # :

    [...] ome decent plugins to play with, namely: flickrss to display my most recent Flickr images, Auto Moderate Comments which seems to be a slightly [...]

  8. 8
    centripetalforces dot com » Blog ... United States »
    pingback on 11/Apr/05 at 2:18 am # :

    [...] of master matthew, I have enabled two snazy plugins. OCM has been jettisoned in favour of Auto Moderate Comments and I have, after pondering [...]

  9. 9
    Mohammad Ullah Canada »
    replied, on 11/Apr/05 at 3:47 am # :

    Wonderful Website. I liked your moderation Plugin, keep up the good work.

  10. 10
    Michele’s Freeminding » By... United States »
    pingback on 17/Apr/05 at 9:55 am # :

    [...] o deactivate Spam Karma: it was eating legitimate comments. Now, I’m giving a try to Ozh’s Auto Moderate Comments Plugin and Wordp [...]

  11. 11
    Viewfinder Design » Blog Archive ... United States »
    pingback on 17/Apr/05 at 12:07 pm # :

    [...] and they work just fine for me. Update: Michael changed his mind and has implemented the Auto Moderate Comments plugin instead. [...]

  12. 12
    You’ve Got Spam at the Dogberry Pa... United States »
    pingback on 22/Apr/05 at 2:48 am # :

    [...] Stop Spam on WordPress. He recommends Optional Comment Moderation but I found the plugin Auto Moderate Comments that accepts the comment or [...]

  13. 13
    Morten Brunbjergs Blog » Blog Arc... Denmark »
    pingback on 29/Apr/05 at 11:45 am # :

    [...] em, røg lige gennem filteret fordi de blev skrevet på nye artikler. Jeg har installeret Auto Moderate Comments plugin, som forhåbentlig gà [...]

  14. 14
    Bitacora de Mauricio Romero @ Guatemala ... United States »
    pingback on 30/Apr/05 at 12:34 am # :

    [...] ma y mantienen moderado al spam…. Moderate Trackbacks: Este plugin hace que todo tra [...]

  15. 15
    Wordpress - Plugins at the Dogberry Patc... United States »
    pingback on 10/May/05 at 5:24 pm # :

    [...] >Visitors Today: <?php echo getVisitorCount(’day’); ?></li>’ Auto Moderate Comments Once installed and activated [...]

  16. 16
    empdesign » Blog Archive »... Argentina »
    pingback on 16/May/05 at 4:47 pm # :

    [...] a autoenlazar aquellas cadenas de texto que coincidan con un titulo de post ya escrito. [...]

  17. 17
    Wordpress Plugin : Auto Moderate Comment... Russia »
    trackback on 07/Jun/05 at 6:29 am # :

    Wordpress Plugin : Auto Moderate Comments

    Wordpress Plugin : Aut…

  18. 18
    Σπιτάκι » B... United States »
    pingback on 15/Jul/05 at 6:53 pm # :

    [...] H Damsel πρότεινε και κανά δυό ενδιαφέροντα plugins (για WordPress πάντα). Το auto-moderate-comments βάζει σε moderation μόνο τα σχόλια που γίνονται σε παλιά, ανενεργά post. Αυτά είναι συνήθως και τα πιο επιρρεπή σε spam. To comments quicktags προσθέτει μια μπαρούλα με κουμπιά για τα comment, που προσθέτουν διάφορα χρήσιμα html tags. [...]

  19. 19
    Infomancy » Comment Spam United States »
    pingback on 20/Jul/05 at 12:22 pm # :

    [...] So now I am running two new plugins: Ozh’s Auto Moderate Old Comments - any posts over 5 days old will have comments switched to require moderation. I didn’t want to end any possible conversations, but those are also the targets of the spambots. A post can be reopened very easily if needed… Kitten’s Spaminator - Wow. This seems to just take care of the rest of things. If you are having any problems commenting, please let me know. I will try to read through the spam reports for any real comments as well… [...]

  20. 20
    Auto Moderate Comments at What’s O... United States »
    pingback on 04/Aug/05 at 9:30 pm # :

    [...] Check it out –> [...]

  21. 21
    CoffeeSwirls » Wordpress Plugin : ... United States »
    pingback on 08/Aug/05 at 1:01 am # :

    [...] Auto Moderate Comments is the aptly named plugin that now takes any comment left on a post with no activity for five or more days and moves it into the moderation queue. From there, I can pick the occasional legit comment to keep and let the others go to the spam pile. This does mean that sometimes a person’s comment will not appear immediately. But if the post is less than five days old, we’re good. Likewise, if there has been a comment placed on a post (a comment that was not deemed to be junk), that comment will not go to moderation, but is immediately allowed. [...]

  22. 22
    Woordenaar » Goed gekeurd Netherlands »
    pingback on 17/Aug/05 at 3:02 pm # :

    [...] Voor elk probleem is wel een oplossing. Maantje kwam met de oplossing voor de spammer van gisteren: Ik heb het in nucleus zo ingesteld dat items ouder dan 6 dagen gemodereerd moeten worden. Zoiets is vast in een WordPress plugin gestopt (want geen standaard oplossing), en ja hoor Auto Moderate Comments is als plugin verkrijgbaar. Comments written on old posts, where old means “not modified nor commented since XX days”, get sent to moderation queue. Much smarter than simply closing comments on old posts. XX is hier 7 dagen, dat lijkt mij voldoende. [...]

  23. 23
    Doug United States »
    thought, on 25/Aug/05 at 4:20 am # :

    I love this plugin as it does save me hours each week. One thing I’d like to see, though. It takes precedence over my blacklist, so I have scores of spams to delete, and inside that jumble is the occasional legit post.

    Is there a way to have this plugin take effect after the blacklist included in WP 1.5.2?

  24. 24
    Ozh France »
    wrote, on 25/Aug/05 at 7:51 am # :

    That seems to be a smart suggestion indeed. I’ll have a look at this when I have some time.

  25. 25
    Doug United States »
    said, on 26/Aug/05 at 4:33 am # :

    Many thanks!

  26. 26
    Antonio Germany »
    thought, on 17/Sep/05 at 6:59 pm # :

    Hi there :)
    I’d really like to get this plugin working, but I don’t understand how to implement it into the comments.php file :(

    I am using WP 1.5.2 und a modificated version of kubricks theme.

    Could you please give an “before” and “after” example. That would be very helpful.

    Thanks in advance!

  27. 27
    Ozh France »
    replied, on 17/Sep/05 at 9:23 pm # :

    Errrm well yes sure.

    Before
    <p>Post your comment</p>

    After
    <p>Post your comment</p>
    <?php wp_ozh_automoderate_status() ?>

    Got it ?

  28. 28
    Utena France »
    replied, on 19/Sep/05 at 9:19 pm # :

    Et hop, en test chez moi :) Merci beaucoup du conseil, et pour le plugin évidemment :)

  29. 29
    __Sakurazuka No Maboroshi__ » Appe... France »
    pingback on 19/Sep/05 at 9:47 pm # :

    [...] [edit]Les trackbacks sont toujours désactivés, le temps de tester la “doublette” Bad Behavior / Auto Moderate Comments, suivant les conseils de Ozh.[/edit] [...]

  30. 30
    Woordenaar on WordPress » Plugins ... United States »
    pingback on 23/Sep/05 at 4:19 pm # :

    [...] Auto moderate comments [...]

  31. 31
    Jeff United States »
    wrote, on 06/Oct/05 at 9:26 pm # :

    This plugin is working peculiarly for me. I tested it by commenting on a very old post. The comment appeared on the post preceded by This comment is awaiting moderation. Shouldn't the comment not be appearing at all?

  32. 32
    Ozh France »
    commented, on 07/Oct/05 at 12:43 pm # :

    Jeff : the plugin auto moderates on old posts. Therefore, it sends comments to moderation queue. So what you've had was just the expected result.

  33. 33
    Markus Mayer Canada »
    wrote, on 11/Oct/05 at 10:07 pm # :

    In addition to the function wp_ozh_automoderate_status() that *prints* the moderation hint right away, a function that just *returns* the string turned out to be what I really wanted. This function could be called, say wp_ozh_automoderate_get_status().

    I wanted to add something like this to the comments.php of my theme:

    if (function_exists('wp_ozh_automoderate_get_status'))
    {
    $msg=wp_ozh_automoderate_get_status();
    if ($msg!="")
    {
    print("\n".
    "$msg\n".
    "\n");
    }
    }

    The reason being that class "alt" draws a box with lines, etc. which looks pretty silly if the box is just empty. Hence I only want to draw the box if there's actually text to be printed.

    Otherwise it works perfectly. ;-)

  34. 34
    Ozh France »
    replied, on 11/Oct/05 at 11:02 pm # :

    Markus » I've slightly updated the plugin (re-get it) so that you can get the value instead of printing it. Just pass 0 (zero) as a parameter to it, as in :
    $msg = wp_ozh_automoderate_status(0);

  35. 35
    Markus Mayer Canada »
    thought, on 15/Oct/05 at 12:18 am # :

    Thanks for the new feature :-). Just one more thing: there are still two print statements left in that function (in the first if: if (!$lastcomment)...).

    Thanks again!

  36. 36
    mai9 Spain »
    thought, on 27/Oct/05 at 2:43 am # :

    from the installation section: I don't have a "yourblog/wp-admin/plugins/", but I do have a "yourblog/wp-content/plugins/", maybe it changed in new wordpress versions, I am using 1.5.2

  37. 37
    Ozh France »
    replied, on 27/Oct/05 at 8:03 am # :

    Oops. Silly typo no-one noticed :)

  38. 38
    Arun India »
    commented, on 15/Nov/05 at 8:02 am # :

    I had a problem with trackbacks. I have to shut down comments due to end nos. of spa**s on my blog. People targetting old posts and send end nos. of entries, I revieved emails from moderation que about 500 a day :(

    While moderating the the qued and deleting the posts I loose genuine comments too from my friends and my blog is loosing its value too.

    I need help here and want to install a complete tool which can help me to fight with them.

  39. 39
    BLOQ7 » FYI Germany »
    pingback on 20/Dec/05 at 7:07 pm # :

    [...] Ich hab daher auf das “Auto Moderate Comments”-Plugin gewechselt. Seit dem ist kein Kommentar [...]

  40. 40
    Steve Europe »
    replied, on 02/Mar/06 at 7:00 pm # :

    Looks like there a conflict with this plugin and askimet. I'm on 2.0.1 and in my blogs i activated your plugin and akismet too.

    Since this activation alla the spam go in the moderation queue and looks like Aksmet do nothing, cause i'm getting bunch of spam someimes, 100 comments alla at once, this is annoying.

    Looks like your plugin filter the comments before akismet and if it puts them in moderation akismet didn't get anything.

    As soon I deactivated your plugin Akismet started to intercept the spam again perfectly.

  41. 41
    Ozh France »
    wrote, 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.

  42. 42
    Steve Europe »
    said, 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 :)

  43. 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.

  44. 44
    Chari United States »
    commented, 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!

  45. 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 … [...]

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

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

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

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

  48. 48
    bushtool United States »
    commented, 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.

  49. 49
    Jenn United States »
    commented, 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. :)

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 ?