News:

Wondering if this will always be free?  See why free is better.

Main Menu

PHP to check if user is guest or logged in?

Started by Pellets, August 10, 2010, 07:10:23 AM

Previous topic - Next topic

Pellets

Is there any PHP-code available to check if the user on the forum is a guest or a logged in user?

CapadY

Please explain ?

When somebody is logged in his name is shown in the forum. In the visitors overview he is called a member.
When somebody is a guest "guest" is shown instead of a name and in the visitors overview also "guest"is shown.
So yes, this is detected by PHP-code.
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

cicka

Quote from: Pellets on August 10, 2010, 07:10:23 AM
Is there any PHP-code available to check if the user on the forum is a guest or a logged in user?

if ($context['user']['is_guest']){
//checks if user is guest
}


or

if (!$context['user']['is_logged']){
//checks again if user is guest
}


or


global $user_info
if ($user_info['is_guest']){
//checks again if user is guest
}


for logged in users you can use this

if ($context['user']['is_logged']){
//checks  if user is logged
}





Kill Em All

I am going to mark the topic solved, please feel free to unmark it solved if you have further questions. :)


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Advertisement: