im trying to get a code to make my Facebook page contents hide until the user like the page (simply change the page content after like)
I created a Facebook application about one year ago and it works well and did what i want https://www.facebook.com/app.graphicano/app_1417521298482387
**the Problem:**i created a new application and used the same code put its not working https://www.facebook.com/app.graphicano/app_711341728921627?ref=page_internal
The code i'm using
<?php
require_once 'facebook.php'; //download at https://github.com/facebook/php-sdk/downloads
$facebook = new Facebook(array(
'appId' => 'APP ID', // enter your App's ID
'secret' => 'Secret', // enter your App's Secret
'cookie' => true,
));
?>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.Canvas.setSize();
}
// Do things that will sometimes call sizeChangeCallback()
function sizeChangeCallback() {
FB.Canvas.setSize();
}
</script>
<?
// Did they like a page?
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
//echo $signed_request.'<br>';
print_r ($data);
if (empty($data["page"]["liked"])) {
// DISPLAY TO: those who didn't LIKE the page
?>
<!-- Didn't Like -->
NON fan page
<!-- End of Didn't Like -->
<?
} else {
?>
Its a fan page
<? } ?>
i need to solve this problem as soon as possible thanks
Like gating is not possible and not allowed anymore, see changelog: https://developers.facebook.com/docs/apps/changelog
Older Apps will still have that "liked" parameter, but they will always return "true" after 5th of November.