Support » Plugins » Help with Auto-close comments

  • I searched the forum and read the wiki. I don’t think I’m doing it right. I am trying to install the plugin for auto-close comments. I don’t know anything about scripts. I just followed the instructions and copied the non-cron script example on the site. I changed the first instance of “age-cutoff.” It hasn’t worked. Am I supposed to change it everywhere? What am I doing wrong? Help, spam is killing me on past posts.

Viewing 15 replies - 1 through 15 (of 22 total)
  • ^bump. Anyone?

    did you activate the plugin?

    also look into installing wp hashcash.

    Yes, I activated the plugin. Any other thoughts? I will give hashcash a try if it’s not too difficult to install. Thanks!

    what did you do to test if auto close works? the plugin doesn’t really auto close comments once the post hits the specified age. the plugin is triggered while doing one of a few normal administrative tasks, at which time the age of posts is checked. one of the triggers is editing a post, so you can edit a post and hit save. it doesn’t matter if you changed anything or not. you just want to see if comments close on a few posts. if that doesn’t work, you’ll probably need to be more aggressive with the age cutoff. set it to 1, edit a post, and see what happens then.

    I did what you said. I edited a post and set the cutoff to 1. I tried to post a month old post and it still let me. I also installed wp-hashcash and apparently I’m not skilled in getting that right because I got hit with more spam. Any other ideas? Thanks for the help so far.

    Oh, another thing is, am I doing it write by cutting and pasting the sample script off the auto-close comment plugin and then uploading it to the respective drive? Thanks.

    Mark (podz)


    Support Maven

    The plugin:
    Copy everything from <?php to ?>
    Paste into notepad
    Save as ‘autoclose.php’
    Upload to /plugins

    You doing that ?


    I didn’t have it saved as ‘autoclose.php’ It was saved as ‘closedcomments.php’ I will give it a try with that. But, I basically copied everything like on the plugin page:

    Plugin Name: Auto-Close Comments
    Version: 0.1
    Plugin URI:
    Description: Autoclose comments after XX number of days without a cron job
    Author: Scott Hanson
    Author URI:
    function autoclose_comments() {
    global $wpdb, $tableposts;
    // Set $age_cutoff to the age at which a post should become stale
    $age_cutoff = ’15 DAY’;
    $cutoff_date = $wpdb->get_var (“SELECT DATE_ADD(DATE_SUB(CURDATE(), INTERVAL $age_cutoff), INTERVAL 1 DAY)”);
    $wpdb->query (“UPDATE $tableposts SET comment_status = ‘closed’ WHERE post_date < ‘$cutoff_date’ AND post_status = ‘publish'”);
    add_action(‘publish_post’, ‘autoclose_comments’, 7);
    add_action(‘edit_post’, ‘autoclose_comments’, 7);
    add_action(‘delete_post’, ‘autoclose_comments’, 7);
    add_action(‘comment_post’, ‘autoclose_comments’, 7);
    add_action(‘trackback_post’, ‘autoclose_comments’, 7);
    add_action(‘pingback_post’, ‘autoclose_comments’, 7);
    add_action(‘edit_comment’, ‘autoclose_comments’, 7);
    add_action(‘delete_comment’, ‘autoclose_comments’, 7);
    add_action(‘template_save’, ‘autoclose_comments’, 7);

    That’s exactly what it is on the plugin page except for the interval. Is that right?

    Oh, there are appropriate spaces in the above. I just pasted it there like that.

    I had the opposite problem with this plugin on my site. When activated, I get only error messages when I try to make a new comment on the most recent post. The older posts were closed to comments though.

    In the end I had to activate it then deactivate it (the closed comments stayed closed) to permit commenting on my most recent posts.


    I get the same error. It says header alerady sent. I’m using WP 1.2.2


    I can still leave a comment on older posts. Arrrgh! So frustrating.

    When I go to older posts I can’t leave a comment. But the spammers can!!! I’ve just had a flood of them on old posts. Very frustrating.

    I also can’t get Kitten’s spam words running on 1.2.2 – the delete as spam button has disappeared from admin altogether.

    When I activate spam karma on the other hand, regardless of changes I make to the set up page, everything gets moderated. Even my own comments when I’m logged in as admin.


    Bumping this topic

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Help with Auto-close comments’ is closed to new replies.