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

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

  2. 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. […] Zoiets is vast in een WordPress plugin gestopt (want geen standaard oplossing), en ja hoor Auto Moderate Comments is als plugin verkrijgbaar. […]

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

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

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

  7. […] 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. […] 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. Wonderful Website. I liked your moderation Plugin, keep up the good work.

  10. […] 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. […] and they work just fine for me. Update: Michael changed his mind and has implemented the Auto Moderate Comments plugin instead. […]

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

  13. […] 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. […] ma y mantienen moderado al spam…. Moderate Trackbacks: Este plugin hace que todo tra […]

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

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

  17. WordPress Plugin : Auto Moderate Comments

    WordPress Plugin : Aut…

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

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

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

  22. Doug says:

    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?

  23. Ozh says:

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

  24. Doug says:

    Many thanks!

  25. Antonio says:

    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!

  26. Ozh says:

    Errrm well yes sure.

    Before
    <p>Post your comment</p>

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

    Got it ?

  27. Utena says:

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

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

  29. […] Auto moderate comments […]

  30. Jeff says:

    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?

  31. Ozh says:

    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.

  32. Markus Mayer says:

    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. ;-)

  33. Ozh says:

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

  34. Markus Mayer says:

    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!

  35. mai9 says:

    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

  36. Ozh says:

    Oops. Silly typo no-one noticed :)

  37. Arun says:

    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.

  38. BLOQ7 » FYI says:

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

  39. Steve says:

    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.

  40. Ozh says:

    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.

  41. Steve says:

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

  42. Zondagavondverzamelpost

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

  43. Chari says:

    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!

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

  45. […] WordPress Plugin : Better Feed « planetOzh (tags: wordpress) […]

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

  47. bushtool says:

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

  48. Jenn says:

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

  49. […] Blogger schließen die Kommentare für ältere Postings. Mit dem Plugin Auto Moderate Comments können stattdessen Kommentare (oder Trackbacks) für ältere Postings automatisch in […]

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 ?