Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 02:57 am EST
Geeklog Forums
Different Header For Members
Anonymous
Anonymous
Anybody know a way to setup a different header for logged in members?
5
4
Quote
Status: offline
Blaine
Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
There is no config parm for this as I recall but ... here are two ideas that I would pursue
This could probably create a functions.php file in the theme directory and then add code in there to manipulate the header template or use an alternate template file.
Or you create a new theme .. disable users from changing themes and then add a small hack to switch themes if user is signed in.
Blaine
Geeklog components by PortalParts -- www.portalparts.com
Geeklog components by PortalParts -- www.portalparts.com
5
4
Quote
Anonymous
Anonymous
Is there any variable that says the user is logged in? I could easily just put an if statement up at the top to look for that if true do the new header.
3
3
Quote
Status: offline
Blaine
Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Well you can not include php code in the .thtml template files. Any code in a functions.php file will be exectuted before most gl components are formated by template files.
Also, the GL template engine does not support if type statements or any other logic in the template files. It parses variables such as {datetime} which are set by the formating code in GL. Example: the function COM_siteHeader in lib-common formats and sets the variables for header.thtml
You can see plenty of code examples that are checking the GL global array $_USER for $_USER['uid'] and a uid > 1 is a signed in user. Anonymous users have a uid of 1
Blaine
Geeklog components by PortalParts -- www.portalparts.com
Geeklog components by PortalParts -- www.portalparts.com
3
3
Quote
Anonymous
Anonymous
"...small hack to switch themes if user is signed in..."
This sounds super cool, has anyone done this? I would use it right now.
Cheers & thanks for infos
Stevyn
4
5
Quote
Anonymous
Anonymous
Well this is not exactly true. You can add php code to the header.thtml, but that is all. So that is what I'll probably end up doing. Thanks
5
4
Quote
Status: offline
rawdata
Forum User
Full Member
Registered: 02/17/03
Posts: 236
Well, go ahead and do it. As stated before, by default anonymous people have a $_USER['uid'] = 1. Everyone else who is signed in has a higher uid. Inside your header.thtml file, just add a simple if/else statement like this:
put the header you want to display to logged in users here
put the header you want to display to anonymous users here
That's it. Anytime the page is called the script will check the person's uid and display different headers to anonymous and logged in users.
Text Formatted Code
<?php if ($_USER['uid'] > 1) { ?>Text Formatted Code
<?php } else { ?>Text Formatted Code
<?php } ?>
5
5
Quote
All times are EST. The time is now 02:57 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content