MyBB Community Forums

Full Version: What is the IF statement to detect whether user is guest or member?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

could anyone please give me the IF statement in order to detect whether a user is logged in or not.

Also, which file is it which is the homepage file, not the index which is always used, but the file i'd need to edit which is the page that is loaded first.

Thanks Smile
if($mybb->user['uid'] == 0)

If that's true they're a guest, else they're logged in.

And I guess you mean global.php but it depends what you want to do. Probably best to have a plugin and use hooks.