Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [Chas-a] Adding LinkOwner page

Quote Reply
Re: [Chas-a] Adding LinkOwner page In reply to
I did something similar before. I can't find the link for it now though :(

This is how I did it;

1) Add a new template, called "user_details". On this template, add a global called "grab_users_details";

Code:
sub {

my $user = $_[0];

# just check we have a username passed, and that
# it isn't the admin one...
return if $user eq 'admin';
return if !$user;

# setup our array
my @links;

# grab the users links :)
my $sth = $DB->table('Links')->select( { LinkOwner => $user } )
|| return $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref) {
push @links, $hit;
}

$links[0] ? return { users_links => \@links } : return;


}

You then need to put this on the template;

Code:
<%grab_users_details($user)%>
<%if user_links%>
<%loop user_link%>
<%include link.html%><BR>
<%endloop%>
<%endif%>

Then, just call it via;

http://www.yoursite.com/cgi-bin/page.cgi?p=user_details&user=myusername

Hope that helps Smile (its all untested, as I'm just doing this from memory... apologies if it doesn't work right away).

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 Adding LinkOwner page Chas-a 2320 Jun 28, 2004, 4:49 PM
Post Re: [Chas-a] Adding LinkOwner page
katabd 2219 Jun 28, 2004, 8:07 PM
Thread Re: [Chas-a] Adding LinkOwner page
Andy 2215 Jun 29, 2004, 2:26 AM
Post Re: Adding LinkOwner page
Chas-a 2191 Jun 29, 2004, 3:02 PM