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

50 Blablas

    Pages: « 1 [2] 3 » Show All

  1. 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. [...]

  2. 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. [...]

  3. 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?

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

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

    Many thanks!

  6. 26
    Antonio Germany »
    wrote, 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!

  7. 27
    Ozh France »
    commented, 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 ?

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

  9. 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] [...]

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

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

  11. 31
    Jeff United States »
    thought, 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?

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

  13. 33
    Markus Mayer Canada »
    commented, 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. ;-)

  14. 34
    Ozh France »
    thought, 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);

  15. 35
    Markus Mayer Canada »
    wrote, 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!

  16. 36
    mai9 Spain »
    replied, 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

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

    Oops. Silly typo no-one noticed :)

  18. 38
    Arun India »
    said, 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.

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

  20. 40
    Steve Europe »
    thought, 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.

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