Facebook: Determine if User is Fan (likes page)
Question
Is there a way to determine if the current user is a fan (now: likes the page) using facebook connect?
I know this is possible in the REST api, but I would like to be able to just use connect instead.
Solution
First you need to log the user in with Facebook connect and the Javascript SDK.
Then in Javascript you can use FB.api to call the Graph API.
FB.api('/me/likes');
This requires the user_likes
permission to be granted when they login.
OTHER TIPS
I'd rather use FQL: SELECT page_id FROM page_fan WHERE uid=me() and page_id=114342017879
If the query returns an empty array, then your user is not fan. If it returns the page id in an array, then he's fan:
[
{
"page_id": "114342017879"
}
]
Webservice url:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow