News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Guest Theme

Started by Fizzy, July 17, 2005, 01:46:56 PM

Previous topic - Next topic

Fizzy

I'm pulling my hair out with this and keep falling flat on my face.

I have created a basic template just for 'guests' to try and save on bandwidth.

I need to get the forum to recognise the fact that they are a guest and then automatically set the theme to 'guest theme' which I have as theme number 99

I'm assuming that the first part of the code to recognise a guest should work but the second part causes parse errors:

// Identify guest and change theme to 99
if ($context['user']['is_guest'])
$options['theme'] = 99);


I can't see the wood for the trees here, can anyone please offer any suggestions?

TIA

Fizz
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Grudge

You have a bracket after 99
I'm only a half geek really...

Fizzy

Thanks Grudge,

I've lost the parse error but the guests are still seeing the normal default template.
I added the above in to index.template.php thinking that would do it, but obviously I'm missing something.

Any thoughts?
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Grudge

You should be putting the code in index.php I reackon.

How about under the call for loadUserSettings putting:


if ($GLOBALS['user_info']['is_guest'])
  $GLOBALS['options']['theme'] = 99;


I'm only a half geek really...

[Unknown]

Why $options['theme']?  That won't do anything.  I think you want $user_info['theme'].

-[Unknown]

Fizzy

Thanks for the suggestions.

I combined it to read as


if ($context['user']['is_guest'])
$user_info['theme'] = 99;


and added it after loadUserSettings in index.php but it still doesn't want to play ball.

"Reality is merely an illusion, albeit a very persistent one." - A.E.


Grudge

You need to make them GLOBALS, the following would do it:

if ($GLOBALS['context']['user']['is_guest'])
    $GLOBALS['user_info']['theme'] = 99;
I'm only a half geek really...

Fizzy

Sorry guys,

It's still not kicking in with template 99 for guests  :'(
"Reality is merely an illusion, albeit a very persistent one." - A.E.


061

well for time being i think u can do this

theme and layout>

Overall forum default: set to theme99
Reset everyone to: to ur member theme

:-[

Advertisement: