Top Commentators Widget


This plugin creates a widget to show the top commentators in your WP site. Always go back to the Widget settings after each version update to Save your settings.

The Top Commentators Widget plugin is adapted from Show Top Commentators plugin at Personal Financial Advice, this widget is easier to manage via the control form (no need to edit the PHP file); additional options are also available to make it more flexible. Read the FAQ section on how to customize the widget. Read the Changelog as well as for the latest news on this widget.

This widget is extensively tested with the following settings: Google Chrome 13.0.782.215 m, PHP 5.2.13, Apache 2.2.15 (Win32), MySQL 5.0.51a, WordPress 3.2.1. Further testing and bug report on this widget is greatly welcomed and appreciated.


  • Top Commentators Widget v.1.0 and v.0.999a control form snapshot in WordPress 2.5.1.
  • Top Commentators Widget v.0.999 control form snapshot in WordPress 2.3.3.
  • Top Commentators Widget v.1.4 control form snapshot in WordPress 3.0.5.


How do I use this in my blog?

Obviously, you must be using WordPress on your site. Your theme must also support widgets (if unsure, check with the person who designed the theme). If it doesn’t support widget, please use the Show Top Commentators plugin instead; it should work similarly to this widget.

What options do I need to set in this widget?

None. Just follow the installation steps and and it is ready to run. Customization is not necessary if you don’t want to bother doing so.

Problem: This widget stopped working after I upgraded. What should I do?

Go to your Widgets settings and click Save in the Top Commentators widget settings. Otherwise, please submit a report in the Support Forum.

Problem: The hour / month / year / (whatever period) Reset Period setting doesn’t work, not matter how I change it.

The “specify number of days/date” value will ALWAYS be prioritized before the Reset Period dropdown options. Therefore, if you choose to use any of the dropdown options, make sure to leave “specify number of days/date” text box empty.

Problem: The widget only appears in my homepage and nowhere else.

By default, the Top Commentators list will appear only in your homepage (read this site to find out why it’s better). If you want the list to appear site-wide, then set the “Show in home page only?” option to No.

Problem: No comment/wrong number of comments appeared after I installed/upgraded the Top Commentators widget.

Try one or more of the following tips below to solve this:

  1. Go to your Widgets settings and click Save in the Top Commentators Widget settings.
  2. Empty the “specify number of days/date” text box.
  3. Make sure the Reset Period is set to the period you choose.
  4. De-activate, and re-activate the Top Commentators Widget. Then go back to your Widgets settings, remove the Top Commentators from your sidebar, and re-add it again. Then Save the widget settings again.
  5. Don’t use the Back button of your browser to go back to your Widgets settings. Always reload the Widgets page before changing the settings further.
What are the options that I can change in this widget?

Good Lord, a lot! Ensure that you first follow the Installation instructions to activate the widget. Once you have the Top Commentators widget on the sidebar, click the control icon of this widget to change the following:

  1. Change widget title: Change the standard title (Top Commentators) to any snazzy title, like Bloggers of the Month or Commentors Who Owe Me a Million Bucks.
  2. Add description below the title: You can add an extra description if you want to. NOTE: Certain WP themes may not display this correctly.
  3. List those with a minimum of XX comments: Show only users who achieve a minimum number of comments before they get displayed here.
  4. Exclude these users: Exclude commentators based on their names, like Administrator or yourself. Don’t enter any email filters here; they belong in the Filter full/partial emails field.
  5. Reset list every period: Reset the list to generate commentors hourly, daily, weekly, monthly, yearly, or all-time. You can also reset the list within a certain number of days, like every 15 days or 66 days and so forth. As of version 1.2, you can specify a specific range of date; for example, to display top commentators between January 1, 2009 and March 31, 2009, you should type 20090101 and 20090331.
  6. Limit the number of names listed: If you want to list the top 20 commentators, type in 20.
  7. Limit the number of characters in each name: Useful if you want to control the list from breaking your sidebar design. Names that have characters longer than your setting will have a trailing ellipses. If you want the names to be longer, change to a higher value such as 35. Otherwise, if, say, you change it to 3, then Lorna will become Lor… .
  8. Add remarks for empty list: Display some notice to appear when your top commentator list is empty, like “Be the first person to comment”.
  9. Filter full/partial URLs: Works just like Exclude Users, except this will filter by URLs.
  10. Filter full/partial e-mails: Works just like Exclude Users, except this will filter by e-mail address. NOTE: This may not work with WP 2.3.3 and lower and currently in the buglist.
  11. Display list type as bulleted or numbered list: That’s pretty much straight-forward.
  12. Hyperlink names: Choose whether you want the commentors’ names to be linked to their URLs or not.
  13. Open each link in a new window: Choose whether you want the links to open a new window (target=_blank).
  14. NoFollow links: In case you want to display their URLs but make it NoFollow to stop Google juice.
  15. Show number of comments made: Like it says.
  16. Group commentors based on e-mail or user names: This option is added to solve the hijacking problem various blogs have been reporting if commentors are grouped by user names.
  17. Show in home page only: If you select Yes, then the Top Commentators list will only appear in your main page; otherwise, the list will appear in all pages that have your sidebar displayed.
  18. Display only commentators with URL: If you select Yes, then the Top Commentators list filter out commentators who did not leave any web site URL in their latest comment.
  19. Display Gravatar: If you select Yes, then a Gravatar will appear on the left side of each commentators name in the Top Commentators list.
  20. Gravatar type and size: If you select Yes in Display Gravatar, the images will appear based on the type and size you specify here.
  21. Awards those with at least XX comments: If the number of comments is equal or greater than the number specified here, then an award icon will appear. No icon will appear if this number is set to zero (0).
  22. Align Award icon: Set where you want the award icon to appear.
Problem: The widget screwed with my sidebar design!! WTF??

Firstly, take a deep breath and calm down.

OK now? Great.

When this happens, it could verily mean that you will need to tweak your CSS file of the WordPress theme you are using. Not only will you need to look into formatting the UL, OL and LI of your sidebar, you also need to consider the use of A in the existence — or absence — of hyperlinked commentators’ names. The easiest way to do this is:
* Identify the CSS elements that exist around and within the Top Commentators Widget. You can identify the tags surrounding the TC Widget with the words “top-commentators” or “widget widget_topcomm”.
* You may or may not want to add a new CSS element specifically for the TC Widget. Get someone you know who’s good with CSS if you’re not comfortable doing this yourself.

By the way, if you want to tinker with the style for this widget’s Gravatar, just add a class called tcwGravatar to your style.css file and add any CSS element to it. For the Award icon, look for the tcwAward class.



  1. Fixed Gravatar’s image request URL.


  1. Bugfix for 1.5 due to not displaying a list at all.
  2. Repositioned add_action() hook.
  3. Rectified commentator grouping by e-mail or by names.
  4. Added an option to list out commentators with a minimum required number of comments before being displayed.


  1. Added Default Blue, Retro, and Blank to the Gravatar icon options.
  2. Optimized the query for “Exclude these users” option (presumably could lower database/memory load?).
  3. Edited the query for commentators’ URL (presumably could solve the “same URL for all users” problem that I tried hard to replicate but couldn’t?).


  1. Further improved query against URL hijacking (searching based on e-mail instead of username).

v.1.4.1 beta

  1. MAJOR CODE REWRITE! This may break any customized CSS you may have on TCW.
  2. Support for multiple instances of the widget. This means that you can have TCW on as many sidebars in your blog as you want, each with its own unique settings.


  1. Added the Award option which will display image or icon of a medal/badge once a commentator reaches a certain number of comments determined by blog owner.
  2. Modified the form to allow default values to be entered automatically when initialized (i.e. widget’s Save button is pressed).
  3. Added support for setting default Gravatars to 404, Mystery Man, Identicons, MonsterIDs or Wavatars.
  4. Repaired the query statement for filtering e-mails.


  1. Rectified the SQL query for filtering list by hour.


  1. Added target=_blank option which will open links in a new browser window.
  2. Added filtering based on range of dates.


  1. Fixed the Year value error which prevented it from being highlighted when selected and saved in the widget control form. (noted by Sebastien,
  2. Added Gravatar support (thanks to the codes by Sergio Nascimento,
  3. Added Display only commentors with URLs.
  4. Fixed the bug which displays the URL of a comment marked as spam, but having the name of a valid commentor (since TCW always selects the latest URL entered by the same commentor user name).


  1. Corrected the extra closing widget tag that appears when Show In Home Only is selected.


  1. Re-arranged functions to avoid redeclare error in WP 2.5.
  2. Modified widget control form to repair unclickable control form.
  3. Added NoFollow option to links.
  4. Added show comment count option.
  5. Fixed the reset period (not tested extensively).
  6. Fixed the URL filtering.
  7. Include option to list users by e-mail or user names.
  8. Include option to filter users by e-mail.

Contributors & Developers

This is open source software. The following people have contributed to this plugin.


Browse the code