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
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work! Want to give me something back for my help? Please see my
Amazon Wish List GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500) Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin |
Pre-Made Template Sets |
FREE GLinks Plugins! Compare our different Plugin packages *new* Free CSS Templates