Comment Plugger

This is another quite useful WordPress plugin that plugs people’s sites who have commented you. However a lot of people don’t like the default settings and it can be quite confusing on how to edit it.

1.First download the plugin from here, unzip it and upload it to your plugins folder.

If you have the latest version of WordPress you’ll realise that you can install and activate the plugin without going through all your files.

Screenshot

2.
Once you’ve installed the plugin edit it by deleting the code that’s there and pasting in this code below.

<?php

/*
Plugin Name: Comment Plugger
Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/

Description: Gives a list of that last people to comment on a post,
with a link to their site if they provided one.
Version: 1.1
Author: Nick Momrik
Author URI: http://mtdewvirus.com/
*/
function mdv_comment_plugger($before = '', $limit = 10) {

global $wpdb, $id;
$commenters = $wpdb->get_results("SELECT comment_author, comment_author_email,
comment_author_url, UNIX_TIMESTAMP(comment_date)
AS unixdate FROM $wpdb->comments WHERE comment_post_ID='$id'
AND comment_approved = '1' AND comment_type <> 'pingback'
AND comment_type <>'trackback' GROUP BY comment_author_email, comment_author
ORDER BY comment_date DESC LIMIT $limit");
if ($commenters) {
$output = '';
$commenters = array_reverse($commenters); //
Reserve the order so most recent commenter is last in the array
foreach ($commenters as $commenter) {

if (!empty($commenter->comment_author)) {

if (!empty($commenter->comment_author_url))

$output .= '<a href="' . $commenter->comment_author_url . '"
title="Visit ' . $commenter->comment_author .
'">' . $commenter->comment_author . '</a> ';

else

$output .= $commenter->comment_author . ' ';
}
}
echo $before . '' . $output . '';
}
}

?> 

and then click update file.

3. Go to your index page and insert this code where you want your comment plugs to go.

<div class="commentplugger">
<strong><?php mdv_comment_plugger('Commenters: ', 25); ?></strong>
</div>

You can then edit it and use your own formatting and change where it says Commenters to something else if you’d like.

Step 4.Finally activate the plugin and then everyone who comments your blog will be plugged.