WordPress.org

Ready to get started?Download WordPress

Forums

Trouble with Comment Plugger hack. (4 posts)

  1. Olivia
    Member
    Posted 9 years ago #

    I'm trying to get the comment plugger hack working, but recieveing this errror:
    Parse error: parse error, unexpected T_FUNCTION in /hsphere/local/home/artific/escapetheday.org/wp/my-hacks.php on line 2

    This is my 'my-hacks.php' file:

    <? php<br />
    function comment_plugger($before = ' &hearts;&hearts;&hearts; ', $limit = 40, $sep = ' &nbsp;&nbsp; ') {<br />
    global $wpdb, $tablecomments, $id;<br />
    $request = "SELECT comment_author, comment_author_url, MAX(comment_ID) as comment_ID FROM $tablecomments";<br />
    $request .= " WHERE comment_post_ID='$id' AND comment_approved = '1' GROUP BY comment_author, comment_author_url ORDER BY comment_ID DESC";<br />
    $request .= ($limit > 0) ? " LIMIT $limit" : '';<br />
    $commenters = $wpdb->get_results($request);

    if ($commenters) {<br />
    $output = '';<br />
    foreach ($commenters as $commenter) {<br />
    if (!empty($commenter->comment_author_url)) {<br />
    $output[] = '<a>comment_author_url . '" title="' . $commenter->comment_author . '">' . $commenter->comment_author . '</a>';<br />
    }<br />
    else {<br />
    $output[] = $commenter->comment_author;<br />
    }<br />
    }

    if (is_array($output)) {<br />
    echo $before.implode($sep, $output);<br />
    }<br />
    } else {<br />
    // echo "No one...yet.";<br />
    }<br />
    }<br />
    ?>

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

  3. Olivia
    Member
    Posted 9 years ago #

    Alright, I gave that a shot, but now I recieve another error.

    Database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE comment_post_ID='2' AND comment_approved = '1' GROUP BY c]
    SELECT comment_author, comment_author_email, comment_author_url, MAX(comment_ID) as comment_ID FROM WHERE comment_post_ID='2' AND comment_approved = '1' GROUP BY comment_author_email ORDER BY comment_ID LIMIT 5

  4. Mark (podz)
    Support Maven
    Posted 9 years ago #

    That error is very odd. I've used Nick's plugins from the start and they are fine.
    What version of WP do you have ?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags