Organizational Research By

Surprising Reserch Topic

seamless way to check if user likes page

seamless way to check if user likes page  using -'php,facebook,facebook-page'

So, I am using an iFrame on my tab and I am doing one of those "like roadblocks" where the user needs to like the page in order to view the secret content. Is there a better and more seamless way of doing this then having to ask for permission?

I know for tabs built with FBML, they dont ask for permission, but I am guessing that is because it is NOT an iframe.


asked Sep 21, 2015 by sachin wagh
0 votes

Related Hot Questions

1 Answer

0 votes

Of course you can! As mentioned in the documentation, Facebook will send you some extra details in the signed_request:

When a user navigates to the Facebook Page, they will see your Page Tab added in the next available tab position. Broadly, a Page Tab is loaded in exactly the same way as a Canvas Page. When a user selects your Page Tab, you will received the signed_request parameter with one additional parameter, page. This parameter contains a JSON object with an id (the page id of the current page), admin (if the user is a admin of the page), and liked (if the user has liked the page). As with a Canvas Page, you will not receive all the user information accessible to your app in the signed_request until the user authorizes your app.

The code taken from my tutorial should be something like:

UPDATED CODE: While the previous code would work. I wasn't checking the validity of the request. This means someone could tamper the request and send you false information (like setting the admin to true!). Code has been updated, following the signed_request documentation approach.

answered Sep 21, 2015 by mannumits1