Search code examples
facebookuserid

$facebook->getUser(); STILL returning 0


I see this has been asked a lot here but I still have yet to come up with a solution. I need to get the user's ID to determine if they have already filled out a form in my app. Here is my code..

require_once('facebook.php');  
$facebook = new Facebook(array(  
'appId'  => 'xxxxxxxxxx',  
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',  
'cookie' => false,  
)); 

$signed_request = $facebook->getSignedRequest();
$page_id = "fb" . $signed_request['page']['id'];
$user_id = $facebook->getUser(); 

I don't know if this is related or not but I can grab the page id just fine. But $user_id keeps returning as 0 for all users except me. I'm guessing that's because I'm an admin of my page.

Does anybody know what the problem is here?


Solution

  • i has this problem too, the only solution was to use oauth before with permission request "user_about_me". Since FB uses oauth 2.0, most user values are hidden and you have to request all this sh*t :(