Voo
Voo

Reputation: 47

Check user liked my Facebook page when the user is on my site

I need to check if a user (visitor) liked my Facebook page ( a page created in Facebook) when he is visiting my site. so as a example if he liked my Facebook page I show him some content. otherwise I show him "please liked"

I tried may methods on the net but not worked any. Please if anyone provide me full code, that will be great

Ps: Please this is NOT ( http://www.facebook.com/HotelGuru.sk?sk=app_233066690095330 ) What I'm asking is user must be on my site and the Facebook page need to check (whether user liked or not)


Also if someone know please tell me how I get page id (fb), because it already a name. I tried viewing html of send button to get the page code. but I'm not sure what I have is actual page code or not.

Upvotes: 0

Views: 441

Answers (1)

Alexander Nenkov
Alexander Nenkov

Reputation: 2910

The easierst way to achieve it is to ask for user_likes permission and then check against your page id.

On getting the pageid you can see it with: http://graph.facebook.com/HotelGuru.sk

Update: To check if user has liked a specific page you can use this query:

https://graph.facebook.com/me/fql?q=SELECT+uid+FROM+page_fan+WHERE+uid=me()+AND+page_id=YOUR_PAGE_ID&access_token=VALID_ACCESS_TOKEN

You will still need basic permissions.

Upvotes: 1

Related Questions