I’m trying for hours now to check if the current user is “liked” my app.
I do require “user_likes” permission on login but even when I’m clicking the like button, when I check if the user like the app with isFan or with FQL I still get zero likes!
this is how I’m trying to get if the user “liked” the app:
$isFan = $facebook->api(array(
"method" => "pages.isFan",
"page_id" => xxxxx,
"uid" => $session
));
if($isFan === TRUE)
echo "I'm a fan!";
OR
$likes = $facebook->api(array(
'method' => 'fql.query',
'query' => "SELECT uid FROM page_fan WHERE page_id='xxxxx' AND uid='$session'",
));
print 'likes found: ' . count($likes) . '<br />';
both methods gives me nothing, please if some one can help me it will be great!
Thanks!
Moti
You want to use the Page ID instead of the App ID. I’m not sure if your page is a Facebook Page (facebook.com/pages/ [PAGE_NAME] / [PAGE_ID] ) or if you have a non-Facebook page.
Obviously if you have a Facebook page then the number on the end of the URL will be your Page ID. Otherwise if you have a non-Facebook page you can use the graph to get your Page ID.
Use that ID instead of the app ID and it should give you the correct result. To be sure try it out with the tool on the Facebook docs