Check if logged in user has liked my Facebook Page

user2441994 picture user2441994 · Jun 11, 2013 · Viewed 30k times · Source

OK. So I have no idea on how to do this but you are going to have to talk like a 3 year old to me. I know PHP, HTML, CSS and a tiny smidge of javascript. I want to be able to make a page that gets the users facebook and checks to see if they have liked my Facebook page (https://www.facebook.com/MrDarrenGriffin). If they have, a redirect will direct them to a page. However, If not, it will tell them that to go to the downloads page, they have to like the page. The liking method could be with the embedded like button in the code. After they have liked the page it will go through the check again and if they have successfully liked my page, it will redirect them to the downloads section (or a specified page).

Thanks in advance :D

Answer

simyos picture simyos · Feb 5, 2014

You can use this code because it's so simple :

FB.api({
    method:     "pages.isFan",
    page_id:        page_id,
},  function(response) {
        console.log(response);
        if(response){
            alert('You Likey');
        } else {
            alert('You not Likey :(');
        }
    }
);

this ll user user_likes permission

Hope this will help you