Gossamer Forum
Home : Products : Gossamer Links : Discussions :

detect if user is linkowner

Quote Reply
detect if user is linkowner
hi,

i want to build a special link on my home-website for link-owners.

the problem i have is, i don't know how to detect if a logged in user is a linkowner or not.

if i get this working the second point i would need is to get the id/ids of the links related to the logged in linkowner.



does anyone have a solution ???

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] detect if user is linkowner In reply to
So you want a global that will check is a logged in user, in fact owns a link?

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!
Quote Reply
Re: [Andy] detect if user is linkowner In reply to
yes, in deed, that's what i want.

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] detect if user is linkowner In reply to
Code:
sub {
my $user = shift;
my $loop = $DB->table('Links')->select( { LinkOwner => $user } )->fetchall_arrayref({});

return { my_total => scalar @$loop, my_links => $loop };
}

The tag for that would go at the top of your page.

<%MyGlobal($Current_User)%>

Then you'd do:

Code:
<%if my_total%>
Your links are:
<%loop my_links%>
<%ID%> - <%Title%><br>
<%endloop%>
<%else%>
You have no links!
<%endif%>

Something like that should work. Double check $Current_User - I can't remember the tag name.
Quote Reply
Re: [Paul] detect if user is linkowner In reply to
$Username should be the currently logged in user.

To avoid potential problems, you'd want to:

<%if $Username%>
<%My_Global($Username)%>
<%if my_total%>
Your links are:
<%loop my_links%>
<%ID%> - <%Title%><br>
<%endloop%>
<%else%>
You have no links!
<%endif%>
<%endif%>


This is an interesting twist to the logged in users problem, that had not been mentioned before.

It's a cute little global.

But, you might want to have two globals, one that simply checks to see if the person has links, ie: flag to show the link to the LinkOwners page, (or to Modify? --- an intelligent link. Don't display "modify a link" on the tool bar unless the user is logged in.... could be confusing though, if a user forgets to log in...), and then one to display the users links if you are not using a built in routine like modify.cgi

Actually, this is a useful little global, that probably should have been written long ago ;)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] detect if user is linkowner In reply to
>>
<%if $Username%>
<<

That would nee to be:

<%if Username%>
Quote Reply
Re: [Paul] detect if user is linkowner In reply to
You should be careful with things like this. In dynamic mode I can just pass in

Username=xxx

in the query string, and I will pass for user xxx. Of course you cannot add or modify links for that user, but you should just be aware that whatever you put in your query string will be available as a template tag (there is a bit of a difference between when you are logged in and when you are not logged in).

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] detect if user is linkowner In reply to
The tag that gives you the name of the logged in user can't be overridden via the query string.
Quote Reply
Re: [Paul] detect if user is linkowner In reply to
Yes, it can be overridden, but only if you are not logged in. If you are logged in, you cannot override it, true.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Paul] detect if user is linkowner In reply to
hi,

the code is what i need. but unfortunately i does not seem to work.

it gives me always a "You have no links!", even if i am logged in as a linkowner in dynamic mode.

any ideas?

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] detect if user is linkowner In reply to
What tag are you passing into the global?
Quote Reply
Re: [Paul] detect if user is linkowner In reply to
my global called "link_besitzer" is :

sub {
my $user = shift;
my $loop = $DB->table('Links')->select( { LinkOwner => $user } )->fetchall_arrayref({});
return { my_total => scalar @$loop, my_links => $loop };
}


and the template-code is :

<%if Username%>
<%link_besitzer(Username)%>
<%if my_total%>
Your links are:
<%loop my_links%>
<%ID%> - <%Title%><br>
<%endloop%>
<%else%>
You have no links!
<%endif%>
<%endif%>


Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] detect if user is linkowner In reply to
>>
Username
<<

Must be:

$Username
Quote Reply
Re: [Paul] detect if user is linkowner In reply to
uups,

Cool

thank you very much for your help. now it works!

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.