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

Displaying a user field on detailed link page

Quote Reply
Displaying a user field on detailed link page
I'm a little stuck with creating a global to display the field Referral_ID from the Users table on the detailed link page. So far, I've got:

Code:
sub {
my $output;
my $sth = $DB->table('Users')->select( { LinkOwner => $USER->{Username} } );

}
return $output;
}
I'm stuck with what goes in the middle. Any help please?

Thanks!
Quote Reply
Re: [anthonyweston] Displaying a user field on detailed link page In reply to
Hi,

I think you actually wanna use the LinkOwner value, not the current logged in user? Try this:

load_ref_id
Code:
sub {
return $DB->table('Users')->select( ['Referral_ID'], { Username => $_[0] } )->fetchrow;
}

Call with this in detailed.html :

Code:
<%load_ref_id($LinkOwner)%>

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!

Last edited by:

Andy: Oct 9, 2012, 1:14 AM
Quote Reply
Re: [Andy] Displaying a user field on detailed link page In reply to
Thanks, but I think there might be something wrong as it returns a build error when building detailed pages:

A fatal error has occured:
Can't call method "fetchrow" on an undefined value at (eval 163) line 2.

Quote Reply
Re: [anthonyweston] Displaying a user field on detailed link page In reply to
Please enable debugging and try again. The code is fine - so that means you are most likely using the wrong field name.

UPDATE: Just found the error. It was looking for the wrong field name. Try the new version

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!

Last edited by:

Andy: Oct 9, 2012, 1:14 AM
Quote Reply
Re: [Andy] Displaying a user field on detailed link page In reply to
Lovely, thanks. Works a treat!