At my index.php I create an Facebook Object and use it to get the UserID.
$facebook = new Facebook(array(
'appId' => FACEBOOK_APP_ID,
'secret' => FACEBOOK_SECRET,
'cookie' => true
));
I also make some API Requests and everything is fine.
Now I switch to another subpage (events.php – which is mostly the same as index.php).
But here I can’t access the USER ID with
$user = $facebook->getUser();
It’s always 0. As I said, the commands to create the Facebook Object is the same – only another webpage as index.php.
//edit – just found out that it’s not only a Firefox problem as I thought before.
Make sure you are passing the $facebook session variable to your new page (events.php). A return of 0 means that there is no logged in user, and therefore the session hasn’t been instantiated.
https://developers.facebook.com/docs/reference/php/facebook-getUser/
Here are some more helpful docs explaining how to get the current user/session using the Facebook PHP SDK: https://developers.facebook.com/blog/post/503/