Gossamer Forum
Home : Products : Others : Gossamer Community :

Global to check if Comm user is "linkowner" in LinksSQL

Quote Reply
Global to check if Comm user is "linkowner" in LinksSQL
Virginia- informed that this could be done. .. . any ideas? I need to do this because I want to display different types of links for each user. E.g a link owner should have different options that a usual web surfer.

Thanks.
Quote Reply
Re: [texhost] Global to check if Comm user is "linkowner" in LinksSQL In reply to
Hi,

Try something like this:

Code:
sub {
my $user = shift;
lib->import('/path/to/links/admin'); # might not be necessary
require GT::SQL;
my $table = GT::SQL->new('/path/to/links/admin/defs')->table('Links');
$table->select_options ('ORDER BY Title ASC', 'LIMIT 5');
if ($table->count( { LinkOwner => $user } )) {
my $loop = $table->select( { LinkOwner => $user } )->fetchall_hashref;
return { my_total => scalar @$loop, my_links => $loop };
}
return;
}

and call in from Communty home page as:

Code:
<%is_linkowner($comm_username)%>
<%if my_total%>
<%loop my_links%>
<%Title%>
<%endloop%>
<%endif%>

Replace the loop with whatever you want - just a suggestion

Cheers
Klaus

http://www.ameinfo.com