Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [sangiro] 10 Most active link submitter?

Quote Reply
Re: [sangiro] 10 Most active link submitter? In reply to
Hi,

This should do it Tongue

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!
Subject Author Views Date
Thread 10 Most active link submitter? Kay 3659 Apr 1, 2003, 8:29 PM
Thread Re: [Kay] 10 Most active link submitter?
Kay 3563 Apr 3, 2003, 4:28 AM
Thread Re: [Kay] 10 Most active link submitter?
SSmeredith 3480 Jun 12, 2003, 6:54 AM
Thread Re: [SSmeredith] 10 Most active link submitter?
Andy 3475 Jun 12, 2003, 7:21 AM
Post Re: [Andy] 10 Most active link submitter?
SSmeredith 3469 Jun 12, 2003, 8:57 AM
Thread Re: [Andy] 10 Most active link submitter?
sangiro 3346 May 18, 2006, 6:31 AM
Post Re: [sangiro] 10 Most active link submitter?
Andy 3300 May 19, 2006, 11:32 AM