• Hello, I’m trying to upload autoshutoff.php (http://codex.wordpress.org/Plugins/Auto_shutoff_comments) into my plugins folder but when I upload and activate the plugin, I get the following error:

    Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home/platonicrelation/public_html/wp-content/plugins/autoshutoff.php on line 7

    Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home/platonicrelation/public_html/wp-content/plugins/autoshutoff.php on line 8

    Parse error: syntax error, unexpected T_STRING in /home/platonicrelation/public_html/wp-content/plugins/autoshutoff.php on line 8

    I copied and pasted the plugin, following the directions exactly as instructed.

    I’ve searched and another person had a similar problem: (http://wordpress.org/support/topic/52183?replies=5). Someone suggested that some characters in the copy/paste were altered which led to the error. This person then linked to a file that appears to fix the problem. Unfortunately, that link no longer works and I’ve got no idea what characters may have been altered to lead to this error. Does anyone have any ideas here? I’ll be willing to post the copy of the plugin that I have, if that would be helpful.

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter michellealaska

    (@michellealaska)

    Bumping this up. Anyone have any thoughts? (Thanks!)

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Do you have any \ characters in the copied/pasted text? Because I don’t on the text I copied and pasted from that page. Try just removing all the \’s.

    Thread Starter michellealaska

    (@michellealaska)

    Hi Otto, thanks for the suggestion! I don’t believe I have any ‘\’s in the text (although I have several ‘/’s).

    I’ll paste the document I have below so you (or anyone else!) can see what I have.

    saved as autoshutoff.php

    <?php
    /*
    Plugin Name: Auto-Close Comments
    Version: 0.2
    Plugin URI: http://codex.wordpress.org/Plugins/Auto_shutoff_comments
    Description: Autoclose comments after 21 days.
    Author: Scott Hanson
    Author URI: http://www.papascott.de/
    */

    /* Add an index on comment_status to wp_posts to speed this up. */

    function autoclose_comments() {
    global $wpdb, $tableposts;

    if (!isset($tableposts))
    $tableposts = $wpdb->posts;

    // Set $age to the age at which a post should become stale
    $age = ’21 DAY’;

    $date = $wpdb->get_var(“
    SELECT DATE_ADD(DATE_SUB(CURDATE(), INTERVAL $age), INTERVAL 1 DAY)
    “);

    $wpdb->query(“
    UPDATE $tableposts
    SET comment_status = ‘closed’
    WHERE comment_status = ‘open’
    AND post_status = ‘publish’
    AND post_date < ‘$date’
    “);
    }

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

    Thanks again for the suggestion and I’d appreciate any other suggestions, from anyone, as to what’s gone wrong.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Problem uploading autoshutoff.php’ is closed to new replies.