Novocaine88 Posted June 14, 2011 Share Posted June 14, 2011 Hi, I'm very new to trying to use facebook's api/sdk and i'm struggling to say the least. I'm trying to put in place code that will simply allow me to show some extra content on a web page if a user has "liked" it. I'm not talking about a page on facebook. This is a separate website that currently has a like button using xfbml using this code; <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({appId: '#####', status: true, cookie: true, xfbml: true}); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> <fb:like-box profile_id="######" width="220" stream="false" header="false" connections="0"></fb:like-box> Ideally i'd like to be able to place something as simple as the following code anywhere on a page; if($HasLiked) { // show some extra content } Every example i come across is considering my website an "app" and tells me that the user needs to authenticate my website to access the users information, which just isn't what i want. I need only to check whether the user has liked the website they are on, nothing else. If the facebook button itself can do this, surely it can't be that hard for me to do as well? Anyway, some guidance on this would be great. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/239339-facebook-detect-if-a-user-has-liked-a-page-or-not/ Share on other sites More sharing options...
fretz Posted July 11, 2011 Share Posted July 11, 2011 http://developers.facebook.com/docs/authentication/signed_request/ The documentation is a bit of a pain to trawl through, but what you need is in there. You create a signed request, and in that signed request there's a page field, with a bool true or false value Quote Link to comment https://forums.phpfreaks.com/topic/239339-facebook-detect-if-a-user-has-liked-a-page-or-not/#findComment-1241196 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.