We are struggling with a problem that is driving me insane.
Using this code…
$facebook = new Facebook($config);
$uid = $facebook->getUser();
if ($uid) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$uid = null;
}
}
if(!$uid) {
$params = array(
'scope' => 'email',
'redirect_uri' => 'https://www.mysite.com/'
);
$loginUrl = $facebook->getLoginUrl($params);
header("Location: $loginUrl");
}
$email = $facebook->api('/me?fields=email');
$email = $email['email'];
$verifyLike = $facebook->api('/me/likes/page_id');
if($verifyLike['data']) {
echo "FAN";
} else {
echo "NOT A FAN";
}
We are getting about 8% of users who are seeing “NOT A FAN” and they are in fact a Fan of our page.
I can’t for the life of me figure out the problem, and I am running out of ideas.
Anyone have any idea what is causing this issue, and more importantly what we can do to fix it?
Thank you.
UPDATE 2/25/12
Reported the bug to Facebook, and they changed the bug status to “Triaged” and the priority to “Low”, but they don’t yet have a solution and are still looking into it. No one else is experiencing this issue?
This is not a bug of facebook, if the user’s pages are set to less than everyone privacy, you must ask the user for the user_likes extended permission.
So these 8% of your users have more privacy on their facebook profiles and their likes are not public. For all other users you don’t even need a valid access_token in the api request.