MyBB Community Forums

Full Version: $mybb->user never returns logged in user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I've been attempting to make an OpenID feature for my board (outside the forums), and need to be able to get user details to update the database after they have logged in via Steam. The problem is, whenever I try to get the user's uid it always returns 0. I printed the entire $mybb->user table and found it isn't returning the correct information:
"Array ( [usergroup] => 1 [username] => [uid] => 0 [displaygroup] => 1 [lastvisit] => 1387708011 [ismoderator] => )", even when I go onto the forums and I'm logged in.

This is the part of my code that handles the MyBB:
chdir( "../../forums/" );
    define("IN_MYBB", 1);
    include("./global.php");
    global $db, $mybb;
    print_r( $mybb->user );

The location of my forums is /forums/ (running 1.6.1) and I'm testing this in /test/login, live here.
I would appreciate any help.
you can try print_r($mybb->user['username']);
I've printed the entire array off, as you can see, 'username' returns nothing.
Probably a cookie issue? Change your cookie path in the acp to /
That would make sense. I've changed it now, but there seems to be no effect. What would I have to do for it to reset?
You would need to delete the old cookies.
Scratch that, I had to wipe my cookie, but I was unable to logout before I did so. How would I correct this for other users?
It works now, thanks very much King Louis.
Everyone needs to delete their cookies, I'm not sure whether there is a better solution.
[redacted]