Reputation: 3
can someone please help me with fb api? I want to display content when a person clicks on the button I like it. When I click the button like so to me it appears, but when I refresh the page, so I have to click again to like. You could write something to you that the man remembered and every time they would fit on the page, so not to have to click on the like?
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '826612577359205',
session : true,
status : true,
cookie : true,
xfbml : true,
version : 'v2.1'
});
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
FB.Event.subscribe('edge.create', function(response) {
$('#hidden_content').show();
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<h1><?php echo $page['name'];?></h1>
<div id="hidden_content" style="display: none;"><?php echo $page['description']; ?></div>
<div class="block-blue" id="like" style="display: block;">
<p>Pro zobrazení tipu je potřeba dát like na naší stránku</p>
<div class="fb-like" data-href="https://www.facebook.com/pages/Betligacz-s%C3%A1zka%C5%99sk%C3%A1-liga-o-pen%C3%ADze/857630110921931?fref=ts" data-layout="box_count" data-action="like" data-show-faces="false" data-share="false"></div>
</div>
Upvotes: 0
Views: 266
Reputation: 73984
The only possible solution for this would be to authorize the user with the "user_likes
" permission and check the like status with the Graph API. But you would need to go through a review process with that permission before anyone without a role in your App (Admin/Developer/Tester) would be able to use it and Facebook will not approved it for "Like-Gating". Also, it is not allowed to incentivize Likes anymore according to the platform policy.
See the changelog for more information: https://developers.facebook.com/docs/apps/changelog
Meaning, you can´t do it and you are not allowed to do it.
Upvotes: 1
Reputation: 2362
Basically, you cannot do that.
It's on Facebook Developer Policy
Read 13 and 4.14
Upvotes: 0