MyBB Community Forums

Full Version: 1.4 > 1.6 changes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
And what sort of stuff are you passing to it...?? Seriously, it's quite hard to know what's going on if we have no idea what the code is, and what variables are being passed. The only things globalised in your function that are actually originally created by MyBB are $mybb and $db; the variables in the DB classes are public, as is everything in $mybb/class_core.php. Wouldn't it be a good idea to add some debugging code to main.php to see exactly where it's failing, or what variables it hasn't got...?? Would have been one of the first things I'd do.
I did and I have honestly no idea where it's going wrong.

The $config['appid' ] is posted to the main.php and the main.php does use it - I do also see the request at the FB server and then the var comes back, $me is filled inside the main.php but inside the MyBB function empty again.
print_r($me);
Returns array inside main.php but does return nothing in the MyBB plugin file (should show up globally since I use global_start).
is $me created inside a function in main.php? if so, is it in the global definitions?
Yes, I added a global $me and it is created by main.php
Right, so main.php does what it's supposed to, $me is set properly at the end of main.php, it just doesn't get included properly?? I don't see how MyBB can stop an included file working properly. This can't be about MyBB not passing variables like you mentioned above as $me is created properly in main.php. If there's no MyBB code in main.php then I genuinely don't think MyBB can be having anything to do with this, considering none of the changes made for 1.6 will have any effect on the code you've provided.
is $me listed as a gobal var in the function within main.php that creates/updates it? I know its a global var in the plugin, but if main.php does not make it global or public if a class then its not going to be available to the plugin
After including $me in the plugin, have you tried print_r($GLOBALS['me']);? I had that niggling issue when I was working with Facebook.
Okay, thank you for your input guys.
I did rename some vars, deleted a few functions and rewrote them to direct execution and also looked for the global $me, it seems to be ported now. The whole problem is tracked back to the cookie creation now that does not seem to work with 1.6, might be some header coming earlier then in 1.4 or something like that. I am not sure yet.

$me becomes empty because the cookie was not created and $session is overwritten by MyBB again, $session was renamed now. I'll see about the cookies and the var porting from protected to public...
Looked at all the files that contain $session and deal with setting cookies for logging in, important ones are ./inc/class_session.php, ./inc/functions.php, ./global.php, and ./member.php... really can't see any major changes, unless anyone else can. Only thing is this in ./member.php:

1.4:

my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true);
my_setcookie("sid", $session->sid, -1, true);

1.6:

if($mybb->input['remember'] != "yes")
{
	$remember = -1;
}
else
{
	$remember = null;
}
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], $remember, true);
my_setcookie("sid", $session->sid, -1, true);

Would that have any effect...??
No, that's just the code for remembering ones login. The problem is that the FB script can not set cookies because of eighter MyBB does not allow it or overwrite it or sending headers before running the plugin hook I think. Not sure though, still looking for that.
Pages: 1 2 3