Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

top 10 user

Quote Reply
top 10 user
Hi,
I have search for this problem on the forum,but didn't find the answer,if I miss it ,I'm sorry.

I want to show top 10 users who have posted the most articles on the main index of my forum,how can I realize it?I know it's easy for the admin to get this information.What I want is all of the users can read this information.

Thank you very much if anyone can help me.
Quote Reply
Re: [antz2008] top 10 user In reply to
Hi,

You can do this with your own global. Add a global:

top10_users

that has:

Code:
sub {
my $output;
my $user_tb = $DB->table('User');
$user_tb->select_options("ORDER BY user_posts DESC", "LIMIT 10");
my $sth = $user_tb->select;
while (my $user = $sth->fetchrow_hashref) {
$output .= qq~
<a href="gforum.cgi?username=$user->{user_username}">$user->{user_username} ($user->{user_posts})</a><br>
~;
}
return $output;
}


Then just put <%top10_users%> wherever you want the user list displayed. Hope that helps,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] top 10 user In reply to
Thank you for your help.

Let me try it.Smile