Jump to content

Recommended Posts

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

  • 4 weeks later...

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.