Comment leaders for the current month
This is a variation of Girlie’s Comment Leaderboard. I’ve seen other people who show the comment leaders for the last 30 days, but I decided I’d rather show the leaders for the current month.
Here’s the code. The items bolded and underlined need to be changed to reflect your blog settings.
<? include (”/path/to/your/connection/file/connect.php“);
$leaders = mysql_query(”SELECT comment_email, comment_url, comment_author, COUNT(*) as comment_count FROM mt_comment WHERE (comment_blog_id=1) AND (comment_email!=’you@yourdomain.com‘) AND MONTH(comment_created_on) = MONTH(CURDATE()) AND YEAR(comment_created_on) = YEAR(CURDATE()) GROUP BY comment_author, comment_email ORDER BY comment_count DESC LIMIT 10“);
while($row = mysql_fetch_array($leaders)) {
while (list($key,$val) = each($row)) {$$key = $val;}
if (!empty($comment_url)) {
$authorlink = “<a href=\”$comment_url\”>$comment_author</a>”;
} elseif(!empty($comment_email)) {
$authorlink = “<a href=\”mailto:$comment_email\”>$comment_author</a>”;
} else {$authorlink = $comment_author;}
echo “$authorlink ($comment_count)<br />\n”;
}
?>
/path/to/your/connection/file/connect.php = location of your connect.php file
1 = your blog ID
you@yourdomain.com = your email address (so that your comments aren’t counted)
10 = number of leaders to show
Update: I added “, comment_email” to the “GROUP BY” section so that it will group by name and email address and not lump people who leave comments with the same name together.
April 19th, 2003 at 11:53 pm
Would this also work for Greymatter??
April 19th, 2003 at 11:56 pm
It depends if Greymatter keeps the data in a database. You’ll probably have to change things to match your table schema. If you can find db info for Greymatter, I can take a peek.
April 20th, 2003 at 12:02 am
Are there things for GM that allow most recent posts section etc…. if so where cna I find them I am searching with google, but that is all I am doing .. searching.
April 20th, 2003 at 8:36 pm
If you look in the sidebar, you’ll see a new section under comment leaders that shows the people with the
April 21st, 2003 at 2:28 pm
scriptygoddess: “I’ve seen other people who show the comment leaders
for the last 30 days, but I decided I’d rather show the leaders for the
current month.”
April 24th, 2003 at 1:41 am
hmm, I have no idea how they keep it. At that point I am lost and do not even know what to show ya.
May 5th, 2003 at 12:53 am
What am I doing wrong when I get this code?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/username/public_html/index.php on line 205
June 15th, 2003 at 5:51 pm
I have switched to MT, and thought this script was written for that, but I cannot find the connect.php that it points too.
Any pointers?
June 15th, 2003 at 5:56 pm
The connect.php file can be found at the girlie matters site.
December 1st, 2003 at 6:32 pm
I’m organizing BB and deleted the posts revolving around my techie mess from earlier in the week, since it was an easy fix. I like…
December 1st, 2003 at 6:53 pm
I fixed the comment subscriptions, so y’all should be set now. I’m not currently using MT-Blacklist, so I need to know if subscribers have any…
December 2nd, 2003 at 4:27 pm
I just implemented the comment leaderboard script available at Scriptygoddess, but I wanted to feature the *yearly* comment leaders as opposed to the monthlies. I…
April 15th, 2004 at 12:19 am
NOTE: I’ve only revised a few scripts here and there,…
June 4th, 2004 at 2:48 am
I tried to add this plugin but got the errors listed below. The only things I changed were my username, password, and the path to the connect.php. Any ideas for what I’m doing wrong?
—-
Warning: main(): stream does not support seeking in /path/to/my/file/footer.inc on line 157
Warning: mysql_connect(): Access denied for user: ‘xxxx@localhost’ (Using password: YES) in /path/to/my/file/connect.php on line 6
I cannot connect to the database.
Warning: mysql_query(): Access denied for user: ‘xxxxx@localhost’ (Using password: NO) in /path/to/my/file/footer.inc on line 159
Warning: mysql_query(): A link to the server could not be established in /path/to/my/file/footer.inc on line 159
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path/to/my/file/footer.inc on line 161
-
June 4th, 2004 at 7:38 am
I would follow the error messages one line at a time… (ie. Start trying to figure out what is on line 157 and work from there…)