Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Editors Login Link

Quote Reply
Editors Login Link
I would like to have the editors link only display on the menu if the username is also an editor. I tried using if editors following if username but that does not seem to work. Any ideas? Unsure
Quote Reply
Re: [jgkiefer] Editors Login Link In reply to
Editor details are stored in a seperate table so you'd probably have to use a global.

Code:
<%if is_editor($Username)%>
...the link
<%endif%>


...and the code:

Code:
sub {
return $DB->table('Editors')->count({ Username => shift() });
}

Last edited by:

Paul: Jan 8, 2003, 2:20 PM
Quote Reply
Re: [Paul] Editors Login Link In reply to
What would the name of the global be?
Quote Reply
Re: [jgkiefer] Editors Login Link In reply to
is_editor, hence is_editor($Username) above :)

...but it can be named anything.
Quote Reply
Re: [Paul] Editors Login Link In reply to
Sometimes the simplest things escape me. Thanks.. Blush
Quote Reply
Re: [Paul] Editors Login Link In reply to
That global does not seem to work. Any other suggestions? Smile
Quote Reply
Re: [jgkiefer] Editors Login Link In reply to
Make sure $Username is defined, if so it should work.

What happens?
Quote Reply
Re: [Paul] Editors Login Link In reply to
I double checked the code, username is listed as an editor. Nothing happens. No error messages and no link displays. Unsure
Quote Reply
Re: [jgkiefer] Editors Login Link In reply to
What does <%Username%> display?
Quote Reply
Re: [Paul] Editors Login Link In reply to
Usernamy displays the Username and the Username is an Editor.
Quote Reply
Re: [jgkiefer] Editors Login Link In reply to
It should be working then.

If username is defined and they are an editor then all the global does is count from the Editors table where the username matches what you passed in, so as long as they exist in the Editors table then it should be returning 1 aka "true" and should then load the hyperlink :(

Last edited by:

Paul: Jan 9, 2003, 11:04 AM
Quote Reply
Re: [Paul] Editors Login Link In reply to
Oh well, thanks anyway.