My Top Commentators Widget: Quick & Dirty
Updated 31/July/2007: Download Top Commentators Widget v.0.999 (read the customization section). And, yes, it works with WordPress 2.3.
Holy Molly, I never thought I’d make one so soon, but it’s true! I’ve created my very first WordPress Widget!
Yeah, well, not exactly. I adapted this Top Commentators Widget from the actual Show Top Commentators (hereto known as STA) plugin by PFA. Here’s actually what happened:
- Went to Giuk.Net as usual, saw MrBadak talking about his newly installed plugins, and I hopped by.
- Excitedly surfed into Personal Financial Advice to download the STA plugin.
- Followed the instructions to the dot, only to find out later that it won’t work if you have Sidebar Widgets activated.
- Googled for a widgetized version of STA, only to find that the download links don’t work.
- Desperately needed to install it, so I did the next best thing a desperate grrrl would do — build one.
- Accidentally sacrificed a few other widgets due to carelessness, but nevermind as I always back-up.
- Destabilized my site with countless access error messages and loads of SQL warnings.
- Trying so hard to stay true to the original codes, only to surrender at the last minute and decided to strip down most of the original codes off, therefore FINALLY COMPLETING MY MISSION!
But wait….
Crapazoola. After more googling, I found out that the STA plugin does run on widgets, if you installed the executable PHP for Text widgets first.
My ego is effectively squashed by this new-found knowledge. It took me an embarrassing 8 hours just to get this heck of a plugin to work as a Widget, which goes to show how badly I need to polish up on my PHP. My so-called Widget is not even fully widgetized yet — there’s no control form built-in, since I was too busy trying to get this plugin to work. Ah well, at least it does work like a Widget now. I’ll give myself until the end of March for it to be a full-blown Widget.
A pat on the back for yours truly for a good effort, though. Here’s the Widget if you’re curious. I would advise you against using this (at least not yet), but if you’ve used STA then you’ll sure to know how to customize it:
You may happily use this full-fledged Widget by downloading here:
Download Top Commentators Widget v.0.999
Installation instructions
- Unzip it to get the topcommentators_widget.php file.
- Upload it into wp-content/plugins folder.
- In your WP admin console, go to Plugins and activate Top Commentators Widget.
- In your WP admin console, go to Presentation | Widgets (for WordPress 2.2) or Presentation | Sidebar Widgets (for older WordPress versions), and drag the Top Commentators Widget to wherever you want it to be.
Customization
Updated 31/July/2007 for v.0.999: Customization is not necessary if you don’t want to bother doing so. If you still want to, ensure that you first follow the Installation instructions above to activate the Widget. Once you have the Top Commentators Widget on the sidebar, click the control icon to change the following in Top Commentators:
- 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.
- Add description below the title. You can add an extra description if you want to.
- Exclude users.Exclude Commentators based on their names, like Administrator or yourself. If there is more than one name, separate them with commas.
Each name must be bound by single quotes. - 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.
- Limit the number of commentors to appear If you want to list the Top 20 Commentators, type in 20.
- 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… .
- Add remarks for empty list Display some notice to appear when your Top commentator list is empty.
- Filter URLs Works just like Exclude Users, but this will exclude the URLs that are entered here. Separate each URL with a comma.
- Display list type as bulleted or numbered list That’s pretty much straight-forward.
- Hyperlink names
Choose whether you want the commentors’ names to be linked to their URLs or not. - 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.
My Wish-List
Enable it to do all the things that Show Top Commentators can do (one more to go).Allow the choice of whether Top Commentators should appear everywhere or only on the index page (an idea I got fromAndy Beard)- An option to group commentators by commentor’s name or by e-mail.
- Show only commentors with URLs (an idea I got from Fruity Oaty).
- Link each user to a page that displays all the users’ comments.
- Enable gravatars.
- Create a sort of statistics that displays Top commentors for the week, month, year, and all-time.
- Do a Top Trackback Site.
- Do a Top Pingback Site.
The latter two could be plugins by themselves.
The end. For now.
Related posts:Check this out: Discover How You Can Earn $2475 For Every 100 Visitors You Refer to This FREE Report!








am i the 1st to comment here? Ok, if i know u have problem doing this.. i can help u. it works perfectly either place whether in sidebar or not. especially like mine with two sidebars, making it three column. my widget control works only the most right sidebar.
anyway, dont want to get you confused, i confused myself too. Hahaha.
Cool stuff!
OMG! I’m a top commenter
Or is it commentor? 
Yeah, I was wondering about that myself! “Commentor” sounds a lot less mouthful than “Commentator”.
Yet commentator makes us sound so prolific, or .. potato like..
[…] I have been involved in some discussions about traffic as of late, namely a post by Darren Rowse of ProBlogger.net. This, of course sparked my interest, so I started reading some of the other ideas…and eventually came to this post by Webgrrrl.net. […]
Grato, depois de muito trabalho, noite toda consegui fazer funcionar, Obrigado.
[…] minha peregrinação por vários blogs até encontrar lá no webgrrrl, informando sobre o assunto e descobri que ele não iria funcionar pois era um comando PHP […]
Hi - I’m going to give this widget a try since I’ve been looking for something like this. Will it work with version 2.1.2? I have been experiencing few minor glitches involving widgets since I upgraded 2.1.2
Anyways - thanks for visiting my blog.
Mon, it should work with WP 2.1.2. WebGrrrl.net itself is running on this latest version. Hope everything goes well.
Installed and working perfectly on my site. Thanks muchly for this
Lorna,
I love the Top Commentators plugin. My only problem is the code is set for monthly, but it did not reset this when April started. What do I need to do to get it to start back at 0 every month? Appreciate your help, thanks again!
That, I haven’t incorporated in. But I promise you by Thursday at least I’ll get that to work.
You might want to download v.0.1.3 now, which includes the monthly reset that you wanted. Thanks for being so patient!
[…] Lorna has a Top Commentators Widget that displays a list of the most active commentators (historically) with a link to each one’s […]
[…] Möglich macht das das Top Commentators Widget. […]
[…] So if you want to encourage people to leave comments on your blog too, you may want to download the widgetized “Top Commentators” plug-in here. […]
I recently downloaded and installed this plugin in my blog, but there’s a problem with recalling the top commentators for the week. For some reasons, the plugin is pulling commentators who commented about a month ago..
Did I miss anything here?
Pelf, you can change this by looking for $listPeriod = “m”; in the code ,then changing “m” to “w”. Make sure you’re using v.0.1.3 of this widget, though. Alternatively, you may want to wait till Monday when I complete the widget interface.
Hahha, Lorna, you know what? I’m not sure from which “week” the widget is pulling my “Weekly Top Commentators” from. The top 10 doesn’t seem to correspond to my current week’s comments.. Hmm..
I have squashed the bug with all my might, and you can now download the latest version (0.9) for the fix.
[…] you have noted, I have put a Top Commentator plugin on my sidebar so that the top ten commentators will be duly worshipped by me for giving me […]
Thank you so much for this plugin. Every time I used the ’show top commentators’ plugin with the the ‘executable PHP for Text widgets’ plugin, it would constantly break my layout in Internet Explorer. But this plugin works flawlessly. Thank you so very much.
I’m glad you find this widget useful, Jason. Your predicament is exactly as Cord’s, due to the CSS issue. I fixed it by linking both the user names and the posting counts, which was not done by the original plugin.
You are a gem, Lorna!
[…] working (They kept causing horrible layout problems in Internet Explorer). I found a widget called Top Commentator’s Widget made by Lorna Timbah, which is a plugin that is based on the popular Show Top Commentator’s […]
Lorna, this is a wonderful plugin. Thanks so much. However, I’m not using it at present because in setting up a WordPress staging blog to get ready for migrating from Movable Type I couldn’t quite get it to work. I was able to install, activate, and configure the plugin (and had configured other plugins successfully), but this version of Top Commentators would not display. I tried several out-of-the-box Widget-ready three-column themes before giving up (for now). Here’s the error:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND comment_type != ‘pingback’ AND comment_author != ” AND ‘ at line 6]
SELECT COUNT(comment_author) AS comment_comments, comment_author FROM wp_comments WHERE comment_author NOT IN ( ) AND comment_type != ‘pingback’ AND comment_author != ” AND comment_approved = ‘1′ AND DATE_FORMAT(comment_date, ‘%Y’) = DATE_FORMAT(CURDATE(), ‘%Y’) GROUP BY comment_author ORDER BY comment_comments DESC, comment_author ASC LIMIT
Ye who comment most
Hi KG, could you make sure that, in setting the Exclude users section, you bind each user names within a pair of single quotes, like so -> ‘Administrator’, ‘Lorna’? You may have missed one. Also, remember to separate the user names with commas.
Let me know if you still have problems using it, and please mention the version number as well.
Sorry, I’m using the latest, .9 … I hadn’t excluded any users, but I went ahead and excluded the two users, this way:
‘admin’,'kgs’
The error is different now, which is interesting. I don’t see anything like this:
near ” at line 13
Note: I migrated this WordPress installation from Movable Type this evening. Is there something that needs to be republished..?
I set up a wp test blog, installed version .9, excluded the one user (admin), made sure the user was surrounded by two straight quotes e.g. ‘admin’ , and selected a different theme (Barthelme 1.1) and am still seeing the “line 13″ error…
http://www.bluehighways.com/presstotest/
I feel I must be missing something. I only have three plugins enabled on the test blog: Askimet, top commentators, and sidebar widgets. I’m using top commentators as a widget… ok, right?
Uh-oh, I think I know why. I managed to re-create the error and, by looking at the SQL statement you showed me, looks like the widget doesn’t run if you don’t set anything inside “Limit number of names to:”
Set some number inside that section, hopefully that’ll solve the issue. In the mean time, I’m adding this to my bug list for the next widget upgrade. Let me know if your problem still persist.
Bingo!! Problem fixed!! Naturally I should have set that value… I assumed (um… making a you-know-what out of u and me…) there were some default values for that field buried in the widget.
Ok, I say again… great widget! you rock gal!
PHEW!! I breathe better now
I get this error after activating and dragging it to my sidebar:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND comment_type != ‘pingback’ AND comment_author != ” A’ at line 6]
SELECT COUNT(comment_author) AS comment_comments, comment_author FROM wp_comments WHERE comment_author NOT IN ( ) AND comment_type != ‘pingback’ AND comment_author != ” AND comment_approved = ‘1′ AND DATE_FORMAT(comment_date, ‘%Y-%m’) = DATE_FORMAT(CURDATE(), ‘%Y-%m’) GROUP BY comment_author ORDER BY comment_comments DESC, comment_author ASC LIMIT
I get the same error I believe, I tried limiting the number of comments as suggested above to 6, but still get the error. Keep up the good work though
[You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND comment_type != ‘pingback’ AND comment_author != ” A’ at line 6]
SELECT COUNT(comment_author) AS comment_comments, comment_author FROM wp_comments WHERE comment_author NOT IN ( ) AND comment_type != ‘pingback’ AND comment_author != ” AND comment_approved = ‘1′ AND DATE_FORMAT(comment_date, ‘%Y-%m’) = DATE_FORMAT(CURDATE(), ‘%Y-%m’) GROUP BY comment_author ORDER BY comment_comments DESC, comment_author ASC LIMIT 6
Oops, never mind, got it working now
Scott, what was the fix?
Sorry shouldnt have mentioned . It was nothign speacial, I just filled in the boxes for the options under. Gave the plugin some variables to work with I suppose, then left myself a comment. It only worked then after I left a test comment. I have a very quiet blog I think just for family. so no comments = error ? anyhow, I left a comment and it works.
“no comments = error ?”
I tried to re-create the error without success. I’ll keep my eyes open just in case I spot 1.
[…] Receive Recognition In an effort to promote discussion on my blog, I decided to install the My Top Commentators WordPress widget. The top commentators during the course of a week will be displayed along with a […]
[…] with the Show Top Commentators plug-in. Those utilizing WordPress Widgets can make use of the My Top Commentators […]
Well, I get the same SQL error - but can’t seem to fix it.
any ideas ?
Let me know what the error message is as well as the WP version you’re using, OK? Thanks for testing it out!
I’m getting the same MySQL error. Gave some variables to the plugin. as suggested by Scott, and left a comment myself. Then I have two scenarios:
1. The same MySQL error
2. A blank list
Does it have anything to do with my MySQL version? Any help will be appreciated
You still having a problem using the widget? Drop me a note if you do, OK?
I’m getting the same MySQL error. Gave some variables to the plugin. as suggested by Scott, and left a comment myself. Then I have two scenarios:
1. The same MySQL error
2. A blank list
Does it have anything to do with my MySQL version? Any help will be appreciated
I thought I should let you know that this plug-in doesn’t work with WP 2.2.
[…] also added the MY Top Commentators Widget. It was giving me a MySQL error so I’ll have to get that fixed before enabling it […]
[…] donc en quête d’un widget qui me permettrait ça et je suis tombé sur le blog du widget : My Top Commentators. Apparemment son auteur avait la même idée que moi puisqu’il n’a fait […]
[…] Top Commentators: Another must have, this plug-in allows you to have a list of commentators in your sidebar, noting the number of comments each has made. IMHO, anything I can do to help build a sense of community is a good thing. […]
Pelf, I have 2.2 installed on a self host and it works for me, no problems
http://www.elsdon.net/wordpress/
Hi Scott, I see that you’re using Mandigo too
Well, when I had the plug-in installed, my sidebars were “frozen”. I could move the widgets around, but the changes were never successfully saved.
That was why I said it won’t work in WP 2.2. But since it’s working on your site, I shall try it again. Thanks for informing me!
Good for you, go for it.
One other thing, when I upgraded to 2.2 I followed the instructions and de activated all my addons, then turned them on one by one. I found that the sidebars widgets add that you install to get side bars widgets wouldn’t work, WP refused to activate it. I think, I could be wrong though, that that functionality is included within 2.2 so therefore not required. Its probably in the FAQ, but I’m notorious for not reading things. So I dont have sidebar widgets turned on, but everything is working. I even un installed the add on from the plug in folder and everything is still working without it.
Do you still have problems using the widget?
[…] can download the Top Commentators widget from Webgrrrl. Just drop the widget into your sidebar and modify it a […]
Wow. Great job! Here i am another victim of not enough googling! I also followed in your footsteps.
1. Found STA on a website
2. Downloaded it only to find out it doesn’t support widgets.
3. Google’d ways to create a widget.
4. Hacked through the original to add widget functionality.
5. In an effort to search for the creator’s e-mail address to contact him regarding the changes I made etc. I stumbled upon your version of it!
6. Reading your post, I see the “executable PHP for text widgets!”
7. Stop to laugh at myself at all that has just happened!
[…] him of this change, I googled, and came across a widget enabled version of the plugin; “Top Commentators” by […]
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND comment_type != ‘pingback’ AND comment_author != ” A’ at line 6]
SELECT COUNT(comment_author) AS comment_comments, comment_author FROM wp_comments WHERE comment_author NOT IN ( ) AND comment_type != ‘pingback’ AND comment_author != ” AND comment_approved = ‘1′ AND DATE_FORMAT(comment_date, ‘%Y-%v’) = DATE_FORMAT(CURDATE(), ‘%Y-%v’) GROUP BY comment_author ORDER BY comment_comments DESC, comment_author ASC LIMIT 10
Bob Meets World is proudly powered by WordPress using the RockinBlue Web 2.0 theme created by Cory Miller
Entries (RSS) and Comments (RSS).
Rodney’s Kontera DynamiContext Plugin plugged in.
Ignore my last comment, fixed now
[…] yeah, download it now. In the mean time, I’m off to finish up my WP 2.2 […]
I’m having some trouble with the plugin. It was working awesome for a long time and then all of the sudden when I go to edit my widgets page the page goes to a blank page when I submit changes. If I deactivate your plugin the widget page works again.
Does anyone have a suggestion?
Thanks
Hi-
I am having a problem with this plugin. I am running wordpress 2.2 and I get this message in my sidebar:
Fatal error: Cannot redeclare ns_substr_ellipse() (previously declared in /home/carinkac/public_html/erika/wp-content/plugins/show_top_commentators/show_top_commentators.php:31) in /home/carinkac/public_html/erika/wp-content/plugins/topcommentators_widget.php on line 26
Any help? Thanks.
-Erika
Erika, it looks like you are trying to run both the Show Top Commentators plugin and the Top Commentators widget at the same time. Go to Plugins and disable one or the other to solve this.
You are so right! All better now. Thanks for the great plugin.
You’re welcome
I am having a problem amending this widget. When I click on it to amend the screen darkens as though the box will appear but it doesn’t. The confusing thing is that it doesn’t happen to all the widgets. I have zenthumb installed and I am able to amend that one. Any suggestions?
Let me check this out — it may be some control form command I need to modify for WP 2.2. Kioko has the same problem as you have. Thanks for the head’s-up.
[…] just installed the Top commentator widget on my blog and I think that its better than maintaining a blog roll. The reason for that is not […]
Hi Lorna!
First, excusme for my English. I want tell you that I believe that I have a problem with the widget. Once I install it and I add it, I cannot personalize it then do not keep the options. You can see it in my blog right now. And yes, I give “save changes him”;) but it does not change anything and when returning to open it default is everything again.
SkasS, this is most probably due to the file permission of this widget in your server. If you have access to change the file permission, make sure you CHMOD topcommentators_widget.php to 666. You can do CHMOD either through your control panel, telnet or http://FTP.
Good luck.
Hi, lovely plugin. I’ve got it working fine, although it doesn’t seem to exclude the urls I’ve set. Am I using the wrong syntax (eg http://www.url.com)?
np, you need to append the http:// prefix in front of each URL you want to exclude for it to work. Let me know if you still have problems filtering it.
What if I don’t have a widget ready theme. Can you tell me the cose to post in my sidebar?
Thanks
Hi Robin, you may want to try out the Show Top Commentators plugin then. You can get it at http://www.pfadvice.com/wordpress-plugins/
show-top-commentators/
[…] Visit […]
[…] a Top Commentators widget that shows the top 5 commenters at CO9s of all time, with a link to their blogs (if they have one). […]
[…] 2) Top Commentators Widget […]
[…] Top Commenters widget is behaving wonkily. It has a tendency to invade and take over the widgets directly underneath it, […]
I am the author of the dKret2 theme. One user of my theme told me your plugin doesn’t work qith my theme. I checked your plugin and saw that you forgot to add $after_widget. So the plugin generates invalid code. I can send you a bug fixed version. Just send me an email.
Thanks, kretzschmar. I wanted to take your offer, but I put off emailing you back till I totally forgot about it
Let me know if there’s anything else that should be fixed, and I really appreciate your help.
[…] are on the D-List also tend to recognize top commentors. In that spirit, I’ve installed a new WordPress plugin written by Webgrrrl that automatically creates a site-wide backlink to our top commentators. Sphere: Related […]
[…] on how I could make this place better. I found that many blogs have a widget called the “Top Commentators Widget.” It allows you to have a sidebar widget with the people that comment the most on your blog […]
[…] Top Commentators Widget - Plugin que mostra os usuários que mais comentam no blog, é muito bom no meu ver, pois incentiva os usuários a comentarem mais. […]
There’s a problem with my theme :/.
I really like this plugin and want to use it, but the plugin “bugs” my theme, and I don’t know what to do :/.
Anyway, this plugin is too nice.
Good work!
[sorry, for my bad english ^^]
Hi beeanka, sorry for taking too long to reply you. Try downloading the widget again; I’ve fixed something that may have caused your problem.
The top commentators widget is a great widget to have on any site. I don’t have one on mine yet, but I sure am getting one!
[…] -Top Commentators Widget - Permite montar uma lista com os leitores que mais comentaram em um determinado tempo definido pelo autor do blog. […]