• I want to exclude myself from being plugged in my comments. I comment with the name Hannah and email [email protected]
    I’d edit it myself but I don’t want to screw up WordPress.

    <?php
    
    function comment_plugger($before = 'Thanks to: ', $limit = 0, $sep = ', ') {
            global $wpdb, $tablecomments, $id;
            $request  = "SELECT comment_author, comment_author_url, MAX(comment_ID) as comment_ID FROM $tablecomments";
            $request .= " WHERE comment_post_ID='$id' AND comment_approved = '1' GROUP BY comment_author, comment_author_url ORDER BY comment_ID DESC";
            $request .= ($limit > 0) ? " LIMIT $limit" : '';
            $commenters = $wpdb->get_results($request);
    
            if ($commenters) {
                    $output = '';
                    foreach ($commenters as $commenter) {
                            if (!empty($commenter->comment_author_url)) {
                                   $output[] = '<a href="' . $commenter->comment_author_url . '" title="' . $commenter->comment_author . '" target="_blank">' . $commenter->comment_author . '</a>';
                            }
                            else {
                                    $output[] = $commenter->comment_author;
                            }
                    }
    
                    if (is_array($output)) {
                            echo $before.implode($sep, $output);
                    }
            } else {
    //      echo "No one...yet.";
            }
    }
    
    ?>

The topic ‘Comment plugging- exclude myself’ is closed to new replies.