Ready to get started?Download WordPress


Plugin: Top/Recent Commenters (24 posts)

  1. Scott Reilly
    WordPress & Plugin Dev
    Posted 10 years ago #

    Plugin: Top/Recent Commenters
    Retrieve the top commenters or most recent commenters to your site (if called outside "the loop") or for a particular post (if called inside "the loop").
    Details can be found at the plugin's
    All of my plugins can be found at
    After having just yesterday released a Recent Commenters plugin, I've deprecated it and rolled it into this new plugin since Top Commenters functionality only requires slight changes to the code for the previous plugin. And rather than maintain two slightly different plugins, I merged them.
    This plugin outputs a list of the N top commenting visitors (with their total comments count) or the most recently commenting authors (with hyperlinks to their homepage if they provided an URL). You can define $before and $after text/HTML to bookend each list item. Specify $num_people to control how many people to list.

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

    Scott - have you thought of making a wiki page for your work ?

  3. Ruby Sinreich
    Posted 10 years ago #

    I am trying to convert something I had on my MT blog (OrangePolitics) that showed the 10 most recently-commented-on posts and the three most recent commenters under each post. I installed your plug-ins yesterday, and I'm halfway there. So thanks a ton for your work on this!
    Is there any way I can hack your plug-in to make this list or something like it? In fact, all I'd really need to do is add the title of the thread and the time of the comment to the list that this plug-in already generates. Please let me know if this is possible, I'm not that good with PHP, but I can mess around a little.

  4. kristin
    Posted 10 years ago #

    any way to exclude a certain commenter? so the blog author isn't included in the list?

  5. Icyshard
    Posted 10 years ago #

    It appears that both you and Scriptygoddess made the same plugin at the same time. They are basically the same, except that she omits users in a different fashion--via email address. I think this method might be better, because sometimes people have the same name--especially if it is common, like Jennifer or Scott! Perhaps you two can combine your plugins since they are so similar? (I'm currently still using yours, since you made that great function for me!)

  6. Scott Reilly
    WordPress & Plugin Dev
    Posted 10 years ago #

    Yup, just surfed by and saw that Jennifer and I had pretty much done the same thing. My version actually will also allow you to omit a user based on email (I only support the exclusion of one person, but the plugin could be changed to allow multiple exclusions). In the function there is a variable called $identity_field which can be set to one of three comment table fields that you'd like to use to identify unique users (comment_author, comment_author_email, and comment_author_url). I default it to 'comment_author', which for my purposes is fine but I now see it is probably inadequate for most people. The value of $identity_field just needs to be changed. Another variable, $omit_this_identity is used to indicate who should be omitted (it corresponds to what you used as the $identity_field; if you had set it to 'comment_author_email', then you would put an email address into the $omit_this_identity field.
    Naturally I only now realize I didn't document any of this on the plugin's homepage (but did have comments in the .php file itself, though).

  7. kristin
    Posted 10 years ago #

    Getting so many errors.
    I'm using it outside of the loop.
    It was trying to pull data from the last post which had no comments so I was getting an error when it was trying to foreach.
    so I commented out the line that has:
    if (!empty($id)) $sql .= "AND comment_post_ID = '$id' ";
    This made it work but now whenever someone doesnt have a URL it shows some of the html for the link still.

  8. kristin
    Posted 10 years ago #

    nm... figured it out
    echo '">' . $commenter->comment_author;
    should be this:
    if (!empty($commenter->comment_author_url)) echo '">';
    echo $commenter->comment_author;

  9. Scott Reilly
    WordPress & Plugin Dev
    Posted 10 years ago #

    Oy. There were those things you mentioned and at least one other bug. The plugin has been updated to v0.91 to fix the problems; please get the latest and see how it works for you.
    Thanks, kristin!

  10. Icyshard
    Posted 10 years ago #

    Awesome! And yea, I saw your post over at Scriptygoddess. Oooh I didn't see that yours did exclusions too! I read some of your examples in the PHP when I set it up, but admittedly just kinda skimmed to find the solution I wanted to implement. :)
    So how would one change it to exclude multiple users?

  11. kristin
    Posted 10 years ago #

    No prob :)
    Will try the new one later today.
    I'm out of town and it's a pain in the butt to use ssh on laptop :)

  12. Anonymous
    Posted 10 years ago #

    To accomodate multiple-exclusions, I updated the plugin:
    This plugin has been updated to add a few new features:
    * Can now define a list of people to exclude from the listings
    * The exclusion list now applies to both 'recent' and 'top'
    * The exclusions can be turned of by setting the new $do_exclusions argument to 'false' (default is 'true')
    * Changed the default $identity_field value to 'comment_author_email'
    And a small item:
    * Changed the internal exclusion variable name from $omit_this_identity to $exclude_from_listing

  13. Scott Reilly
    WordPress & Plugin Dev
    Posted 10 years ago #

    Ummm, that was me.

  14. Plugin updated to v1.0

    This plugin has been updated with the following changes:
    * Verified to work for WP 1.5 (still also works for WP 1.2)
    * Fixed bug where "target=" would appear for commenters who did not have URLs
    * Renamed function from get_commenters() to c2c_get_commenters()
    * Moved WP 1.2 compatibility check outside of the primary function.
    * Updated license and examples

  15. Sparky
    Posted 9 years ago #

    Is there a way to show both the recent commenters and the top comments? I have the code on my page for both, but in get-commenters.php I want the top commenters to have bullets and the recent commenters to be seperated with commas. I know how to change it, but not so it's different for both; just the same. How can I do this??

  16. Sparky: Assuming your current call to c2c_get_commenters() is fine for top commenters, here is how to get comma-separated recent commenters:

    <?php c2c_get_commenters ('recent', 5, '', ', ', true); ?>

  17. Sparky
    Posted 9 years ago #

    Great, thanks. In place of the number, is there a symbol like % or something that I could put so it plugs everyone that commented on that entry, rather than just five or something?

  18. When calling c2c_get_commenters(), send some ridiculously high number as the second argument (i.e. 999) instead of 5. That should cover all the people commenting on your post, eh?

  19. Sparky
    Posted 9 years ago #

    Yup, I don't get that many. ^_^ Bu it would only plug people from that entry right? Not entries before too? I was scared that if I put a big number like that, that it would plug 999 commenters total, but I guess not, right?

  20. Depends on where you put the function. If you put it inside "the loop" (see http://codex.wordpress.org/The_Loop if you don't know what I mean) then it will only give you commenters for that post. If you put it outside "the loop" it'll give you commenters for the entire blog.

  21. Sparky
    Posted 9 years ago #

    One more question. :) I re-added the top commenters code to my blog, and it comes right after the recent commenters. The only thing is that now it just has the recent commenters and (1) next to it... But I changed it to say top rather than recent.


  22. Truth
    Posted 9 years ago #

    I'm using this plugin for both the top commenters and the recent commenters plug... Is there a way to echo "None." for the recent comments if there are no commenters so far for that post?

  23. This plugin isn't actively supported anymore, but the fix for what you want should be pretty simple. In the plugin, find this line:

    if (empty($commenters)) return;

    Change it to:

    if (empty($commenters)) { echo 'None'; return; }

    If you only want "None" to appear for empty "Recent Commenters" and not "Top Commenters", use this instead:

    if (empty($commenters)) { if ('top' != $type) echo 'None'; return; }

  24. Truth
    Posted 9 years ago #

    Oh .. Thanks.. it worked nicely.. :)

Topic Closed

This topic has been closed to new replies.

About this Topic