scriptygoddess

02 Mar, 2003

Comment leader (month based)

Posted by: Jennifer In: Scripts

I really liked Girlie's "comment leader board". My only problem was that, I've been blogging for nearly two years. People who commented a lot on my site a year ago, don't neccessarily come by anymore – and there's new people who come by, who comment a lot, and I feel they should be able to get some recognition too… SO, I evened out the score. I modified the code so it will only look at the last month for top commenters.

Girlie has the original script here… Just replace this code:

$leaders = mysql_query("SELECT comment_email, comment_author, COUNT(*) as comment_count FROM mt_comment WHERE (comment_blog_id=8) AND (comment_author!='girlie') GROUP BY comment_author ORDER BY comment_count DESC LIMIT 5");

With this:

$leaders = mysql_query("SELECT comment_url, comment_author, COUNT(*) as comment_count, comment_created_on FROM mt_comment WHERE comment_blog_id=1 AND comment_author!='YOURNAME' AND unix_timestamp(now()) – unix_timestamp(comment_created_on) <= 2678400 GROUP BY comment_author ORDER BY comment_count DESC LIMIT 5");

Change "1" to the blog id of your blog, "YOURNAME" to whatever you use as your name when you comment in your own site, and "5" to how many "leaders" you want to display.

If you want to change the timeframe, you need to replace the "2678400". Here's some other numbers to use:

One week: 604800
Two weeks: 1209600
One month: 2678400 (used in example above)
Two months: 5266800
Six months: 15894000

2 Responses to "Comment leader (month based)"

1 | girlie

March 2nd, 2003 at 11:57 am

Avatar

Just wanted to mention that the code I posted actually comes from Brenna. I'm still learning this stuff. =)

2 | Couchblog

March 3rd, 2003 at 3:52 pm

Avatar

Top 5 Kommentatoren » Update
Ok, das hat nicht so gut geklappt. Aber ein wenig Recherche und schon wird man fündig, nämlich hier und hier,

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements