Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Conditional logic for logged in users only

Aloittaja michaeloeser, lokakuu 21, 2013, 11:36:01 AP

« edellinen - seuraava »

michaeloeser

I´m looking for a conditional logic for logged in users. Something like this

if (USER IS LOGGED IN) {

   DO SOMETHING
}
else {
   DO SOMETHING ELSE
}

Any ideas? Shouldn´t be difficult but I can´t find the conditional logic.

Arantor

Depends where you're trying to do this as to what it will be. Where exactly is this going to be?
Holder of controversial views, all of which my own.


michaeloeser

Figured it out by myself.

if ($context['user']['is_logged']) {
template_info_center();
}


So dead simple  ;)

Arantor

Except it isn't as 'dead simple' as you make it out to be. There are other circumstances where $context['user'] cannot be relied upon and won't even exist. Which is why I asked, but I'm glad you got a solution.
Holder of controversial views, all of which my own.



Advertisement: