MyBB Community Forums

Full Version: Check if user logged in via globals.php?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Need another help, how to perform a check if user logged in inside globals.php?

I tried this and didnt work..

globals.php
if ($mybb->user['uid']) { $message = "You are logged in"; }
else { $message = ""; }
Try this:

if(!$mybb->user['uid'])
{
$message = "You're logged out!";
}
else
{
$message = "You're logged in!";
}

Remember, if it's in function, make sure $mybb is globalised. Smile
(2013-03-22, 11:28 AM)Seabody Wrote: [ -> ]Try this:

if(!$mybb->user['uid'])
{
$message = "You're logged out!";
}
else
{
$message = "You're logged in!";
}

Remember, if it's in function, make sure $mybb is globalised. Smile

Still cant, even though mybb confirms im logged in, and displays UID as 2, but for your code, it says im logged out x_x
You should develop a plugin instead of making core edits and eval()uate the code.
(2013-03-22, 11:56 AM)Nathan Malcolm Wrote: [ -> ]You should develop a plugin instead of making core edits and eval()uate the code.

Lol I wish i could, but I dont have basics to make one. I'll try figure things out. A little more hardwork might give a better result right? Big Grin


Thanks for helping one again @Seabody. I was able to solve this issue ;D. The codes are correct but again, placed on wrong section haha xD. Below is what I did Big Grin

global.php (line 61, after session declare)
// Create session for this user
...
if ($mybb->user['uid']) { $message = "You are logged in"; }
else { $message = ""; }

Thank you again Smile