$mybb->user never returns logged in user
#1
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.
Reply
#2
you can try print_r($mybb->user['username']);
Reply
#3
I've printed the entire array off, as you can see, 'username' returns nothing.
Reply
#4
Probably a cookie issue? Change your cookie path in the acp to /
Support PMs will be ignored!
Reply
#5
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?
Reply
#6
You would need to delete the old cookies.
Support PMs will be ignored!
Reply
#7
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.
Reply
#8
Everyone needs to delete their cookies, I'm not sure whether there is a better solution.
Support PMs will be ignored!
Reply
#9
[redacted]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)