Adding a “likegate” to your application is very easy, and only takes a few lines of code to achieve. If you’re not familiar with a “likegage”, it’s basically a page that users’ who haven’t liked your page see, usually asking them to Like the page before seeing the actual content. Users who have already liked your page see something different. The below assumes that your application has been installed on your Facebook page.
Using the Facebook PHP SDK, you can get the
signed_request to see information about the viewer of the application on your page.
print_r the content of the
signed_request, you will see something similar to:
Notice that you can also find out if the viewer is an administrator of the page, allowing you to show a link to the admin area for your application.
signed_request is encrypted using your application secret so it cannot be forged. The
page array will return the ID of the current page, so you can also taylor your application to show different content on different pages. If the
user is connected to your application, the
user array will also include their ID and some basic information.