how about a moderate old comments plugin?

OZH had one of those but the download link is dead: http://planetozh.com/blog/2005/02/wordpress-plugin-auto-moderate-comments/

I think I could use something like that, here is a description taken from that page:

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

sounds great to me, should be simple to code, anyone supporting this request?
or do you consider this outdated? I think I'd love to use it.

  • Jonathan
    • The Incredible Code Injector

    Okay, I just tested it.
    http://wordpress.org/extend/plugins/ozh-auto-moderate-comments/
    And it works.

    New post - comment wasn't moderated.
    Old post - comment was held for moderation.
    Once approved - comment author could post comments on that thread without moderation.
    but commnet author was moderated on other old posts he tried to comment on.

    That's all the time I have for testing, but it seems ozh plugin still works.

    Cheers,
    Jonathan

  • Ovidiu
    • Code Wrangler

    did I understand this right that I need to add <?php wp_ozh_automoderate_status() ?> to comments tempalte files so users see the message about whether a comment will be moderated or not?

    if we need this, how would I hook it into all themes via a hook? would this one work? comment_form according to the codex its a template action, surely adding one line to a file placed inside mu-plugins would trigger this on all blogs?

    can someone clarify and maybe help?

  • Jonathan
    • The Incredible Code Injector

    @Ovidiu,

    The plugin already hooks into

    add_action('comment_post', 'wp_ozh_automoderate',30);
    add_action('trackback_post', 'wp_ozh_automoderate',30);
    add_action('pingback_post', 'wp_ozh_automoderate',30);

    So, I added nothing to my templates. I think the template addition is only to customize the text. To read...

    Moderation Active: Old stuff here... Therefore your comment on this post will be moderated (i.e. don't submit twice !)

    But mine just defaults to ...

    <p class="alert moderation">Your comment is awaiting moderation.</p>
    
    I’m spamming you – lol

    I could be missing it entirely, its late and I'm off to bed :wink:
    So Hope that helps.

    Regards,
    Jonathan

  • Ovidiu
    • Code Wrangler

    thanks chap, but as I understood those hooks, they will just print out that the comment is awaiting moderation after it has been submitted while if we managed to hook this: <?php wp_ozh_automoderate_status() ?> into a relevant hook around the comment form, it would show visitors a warning I can define if they are about to comment on an old post, that is the reason I asked about how to hook it into all templates comment forms via a small plugin placed inside mu-plugins :slight_smile:

    any takers for this or am I misunderstanding things here?

  • Jonathan
    • The Incredible Code Injector

    Sorry, was tired last night :wink:

    Here is your code:
    ADD TO FUNCTIONS.PHP

    add_action( 'comment_form', 'my_comment_moderation_message' );
    
    function my_comment_moderation_message() {
    	wp_ozh_automoderate_status();
    }

    http://codex.wordpress.org/Function_Reference/comment_form
    and if you don't like the position of the automoderate status text, here some interesting reading
    http://ottopress.com/2010/wordpress-3-0-theme-tip-the-comment-form/

    Cheers,
    Jonathan

  • Ovidiu
    • Code Wrangler

    :slight_smile: thanks chap, BUT I won't go adding that to each functions.php so can it be instead used in a my_snippets.php inside mu-plugins like this:

    <?php
    /*
    Plugin Name: zice.ro extras
    Description: my random snippets
    Author: ovidiu
    */
    add_action( 'comment_form', 'my_comment_moderation_message' );
    
    function my_comment_moderation_message() {
    	wp_ozh_automoderate_status();
    }
    ?>

    oh and since you'been so helpful, how about wrapping the whole thing into an function_exists() function to make sure it doesn't break if I ever deactivate the comment moderation plugin?

    like this?

    <?php
    /*
    Plugin Name: zice.ro extras
    Description: my random snippets
    Author: ovidiu
    */
    if (function_exists(wp_ozh_automoderate_status) {
    add_action( 'comment_form', 'my_comment_moderation_message' );
    };
    function my_comment_moderation_message() {
    	wp_ozh_automoderate_status();
    }
    ?>

    but I am really,really, no coder, please check my lines above :slight_smile:

  • Jonathan
    • The Incredible Code Injector

    Well, a functions.php file is just another auto-loading plugin specific to the active theme. As long as the original wp_ozh_automoderate plugin is active on each site then I don't see any reason why bundling it into a network activated snippet plugin wouldn't work.

    Regards,
    Jonathan

  • Jonathan
    • The Incredible Code Injector

    Oops, didn't see your edit and function check (which is a great idea) :wink:

    Here is fixed plugin code:

    <?php
    /*
    Plugin Name: zice.ro extras
    Description: my random snippets
    Version: 0.0.1
    Author: ovidiu
    */
    
    if (function_exists(wp_ozh_automoderate_status)) {
    add_action( 'comment_form', 'my_comment_moderation_message' );
    function my_comment_moderation_message() {
    	wp_ozh_automoderate_status();
    }
    
    }
    
    ?>

    Regards,
    Jonathan

  • Ovidiu
    • Code Wrangler

    can't get it to work. the moderation plugin works fine but the warning about the old post is not shown anywhere.
    tried different themes but all should have the comment_form hook deleted caches still nothing.
    can you give it a quick try on your side please?

  • Jonathan
    • The Incredible Code Injector

    You're welcome and I agree, drop this

    add_action( 'comment_form', 'my_comment_moderation_message' );
    function my_comment_moderation_message() {
    	wp_ozh_automoderate_status();
    }

    into the plugin, as it hasn't been updated for a couple of years :slight_smile:

    Cheers,
    Jonathan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.