News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

$context['user']['is_guest'] in sources

Started by kaamaru, July 07, 2010, 09:50:20 AM

Previous topic - Next topic

kaamaru

how can I use:

if ($context['user']['is_guest'])
	
	
	
	
	
{


in a sources file?

kaamaru

Would this work?

if ($user_info['is_guest']){

cicka

Quote from: Calumks on July 07, 2010, 09:50:20 AM
how can I use:

if ($context['user']['is_guest'])
	
	
	
	
	
{


in a sources file?

It depends on what you want to achive. But basically use it like this.

if ($context['user']['is_guest']){
//Your code here that you want to show to guests or whatever
}


Then if the $context variable has not being globalized, then make it global, like this.

global $context;
if ($context['user']['is_guest']){
//Your code here that you want to show to guests or whatever
}



Yes, $user_info['is_guest'] will work too. But make sure that $user_info is globalized.

kaamaru



Advertisement: