Chatterbox

Because I like to “showcase” my top commenters, I made a little box for those who comment the most. It’s a “top 5 list” of the people who have commented the most. Just insert this EE code where you want it to show up:

{exp:query sql=”SELECT DISTINCT name, email, url, count( email ) AS count FROM `exp_comments` GROUP BY email ORDER BY count DESC LIMIT 0 , 5″}

<a href=”{url}” target=”_blank”>{name}</a> – {count} retorts<br />

{/exp:query}

That will give you the top commenters for all your weblogs with the commenter with the most comments on top. If you want to narrow down by weblog, then add a WHERE statement saying “WHERE weblog_id=#” where # is the weblog ID number. Therefore the query will read: “SELECT DISTINCT name, email, url, count( email ) AS count FROM `exp_comments` WHERE weblog_id=1 GROUP BY email ORDER BY count DESC LIMIT 0 , 5″

How does this post make you feel?
  • Excited
  • Fascinated
  • Amused
  • Bored
  • Sad
  • Angry
This entry was posted in Uncategorized by Yoshi. Bookmark the permalink.

7 thoughts on “Chatterbox

  1. Hehe yeah at first I had retorts…then I thought. no. LOL So i just changed it to comments. i’m sure i’ll think of something else. :)

  2. On an unrelated item – do you have any idea how to display a single entry in a template?

    I’ve tried, but everything I’m doing is wrong.

    I thought it was entry_id = “69” or some such thing.

  3. I saw your post on the pmachine forums, and thought about that. I haven’t tried any testing with that yet, but I remember seeing that as well in the docs. If I find out more before someone else I’ll be sure to let ya know. :cowtiny:

  4. i responded, i noticed you had spaces in there;

    eg. weblog = “weblog1”

    instead of:

    weblog="weblog1"

    that fixed it for me.

  5. Yeah, I saw your post on the PM Forum. Sounds like a bug to me.. but as long as I remember, it’ll be great. Gonna go write the article now.

    Thanks again for the quick answer. I’m been cranking on a new site that has to go live on the 1st. It’s for an entertainer in the news lately.