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.

Was it helpful?

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.

http://developers.facebook.com/docs/reference/api/user

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:

https://api.facebook.com/method/fql.query?query=SELECT+page_id+FROM+page_fan+WHERE+uid%3Dme%28%29+and+page_id%3D114342017879

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top