comment plugger
-
I recently was having a problem with the comment plugger plug-in when I upgraded wordpress, I had always been able to post the previous entries commenters in my most recent entry. For some strange reason when I updated my comment plugger plugin as well I was no longer able to do that…. I found old version of it that I was using, and installed it back again.
I had been told by someone on this board that it was not possible to show your previous comments plugged on a recent entry. (show monday’s commenters on tuesday’s entry)
I did not write this plug-in, full credit goes to the origional author. I do not even recall where I got it from, though I do find pretty much all of my plug-ins here at the board or on various known websites. I just wanted to share this with everyone. If I am wrong and everyone knew about this, then forgive me.
<?php
/*
1. Include the code below in the index file.2. Use one of these functions to display commenters:
<?php comment_plugger(0); ?> - show commenters from current post
<?php comment_plugger(1); ?> - show commenters from last post
*/function comment_plugger($show = 0, $limit = 0, $sep = ', ', $none = ' none') {
global $wpdb, $tablecomments, $id;
$cid = ($show) ? ($id - 1) : $id;
$request = "SELECT DISTINCT comment_author_url, comment_author FROM $tablecomments";
$request .= " WHERE comment_post_ID='$cid' AND comment_author <> '' AND comment_author_url <> ''";
$request .= ' ORDER BY comment_author ASC';
$request .= ($limit > 0) ? "LIMIT $limit" : '';
$commenters = $wpdb->get_results($request);
if ($commenters) {
$output = '';
foreach ($commenters as $commenter) {
if (!empty($commenter->comment_author_url)) {
$output[] = 'comment_author_url.'" title="'.$commenter->comment_author.'" target="new">'.$commenter->comment_author.'';
}
}
}
if (is_array($output)) {
echo implode($sep, $output);
} else {
echo $none;
}
}?>
- The topic ‘comment plugger’ is closed to new replies.