Hi,
This should do it
Code:
sub {
my $back;
my @links;
my $min_links = $_[0] || 2;
my $Links = $DB->table('Links');
$Links->select_options('GROUP BY LinkOwner', "HAVING link_cnt > $min_links", 'ORDER BY link_cnt DESC','LIMIT 10');
my $cond = new GT::SQL::Condition;
$cond->add('LinkOwner','!=','admin');
my $sth = $Links->select(
['LinkOwner',
'COUNT(LinkOwner) AS link_cnt'], $cond) || return $GT::SQL::error;
while (my ($user) = $sth->fetchrow_array) {
my $link = $DB->table('Users')->get( { Username => $user } );
$link->{LinkCount} = $DB->table('Links')->count( { LinkOwner => $user } );
push @links, $link;
}
return { Top_Submitter_Loop => \@links };
}
Cal with:
Code:
<%top_submitter('1')%>
<%loop Top_Submitter_Loop%>
<%Username%> (<%LinkCount%>) <br/>
<%endloop%>
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my
Amazon Wish List GLinks ULTRA Package | GLinks ULTRA Package PRO Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin |
Pre-Made Template Sets |
FREE GLinks Plugins!