Facebook Check if user "Liked" the page

13,507

Solution 1

I found this on the Facebook forum I think it might help you out!

How can i redirect when someone like/share?

I haven't tried it myself though!

Good luck!

Solution 2

You can use either the JS or PHP sdk to check if a user liked a page. See examples below...

Uses JS sdk to check if a user liked a page (can be any page, just set the page id). This can be used in a standalone app or from within a page tab. - http://unbound-media.com/facebook/how-to-tell-if-a-facebook-user-likes-your-facebook-application/

Uses PHP sdk to check if a user liked the page from a tabbed app (can only check if user liked the current page they're on). This method can also be converted to JS. - How to check if a user likes my Facebook Page or URL using Facebook's API

Solution 3

If you are dealing with facebook app tab page, the following code helps you to find isfan status

$signed = parse_signed_request($_REQUEST['signed_request'], 'YOUR-APP-SECRET');
if ($signed['page']['liked'] == 1) {
    $fan = true;
} else {
    $fan = false;
}

Visit this link for demo and source code.

Share:
13,507
Dean
Author by

Dean

Hey, I have been in IT and development for a few years. Began as a sys-admin for Microsoft based networks and later became a web-developer. Currently I am more interested in Linux and development, and I study EE. I like the outdoors and enjoy hiking :)

Updated on June 05, 2022

Comments

  • Dean
    Dean almost 2 years

    I made a few Facebook FBML Canvas pages (Facebook considers these to be Applications) for a company, and they requested that users who "Like" the page would be redirected to another page, or the page will display different content with AJAX.

    I went through the Facebook Developers Documentation, but I can't find a clue on how to do it.

    I'm sure someone has done it before, any suggestions?

  • Trufa
    Trufa about 11 years
    @harsh this is the best I can do web.archive.org/web/20110819203920/http://…