Facebook like button popup gateway for facebook pages - facebook

I was wondering how do they create the page on facebook with like button as a gateway to enter and browse through the page...
Here is the one example....
http://www.facebook.com/Diesel?sk=app_168523776552050
I know how to create page in iframe and put in in facebook but I dont know how they show this popup and how do they show it for non fan visitors.
Please enlighten me with your ideas and works.....

This is a simple "Fan Gate", and on the none-fan version they show the normal like button via the url of the page.
A simple way to build a fan gate yourself is described here: http://www.chilipepperdesign.com/2011/02/15/reveal-fan-gate-like-gate-facebook-iframe-tab-tutorial-with-php
The like button:
<fb:like href="http://www.facebook.com/diesel" send="true" width="450"
show_faces="true"></fb:like>

try this:
authenticate your application and get an access token
use access token to authenticate your user and to get a 'signed request' from FB.
'signed request' will tell you whether the user is fan or not
write some code: if (user is fan) { show content for fans }
else { show content for visitors }
Nothing happens without the 'signed request'. Works in PHP and JS.

Parse the 'signed_request' parameter from Facebook. See http://developers.facebook.com/docs/howtos/login/signed-request/
Each signed request contains a 'page' key with a 'liked' subkey whose value is a bool of whether the page has been liked.
Display the banner depending on the value of that bool.
Note that only the Page Tab view has a like button on it. The Canvas App does not have a like button surrounding it.

Related

Subscribe plugin not working

So I have a website where I want to put the subscribe button, here is the code
<!--FB SUBSCRIBE!-->
<div class="fb-subscribe" data-href="http://www.facebook.com/Entendu.info" data-layout="box_count" data-show-faces="true" data-font="arial" data-width="50"></div>
But when I visit the webpage (www.entendu.info/moderate) On the right where the susbscribe button is suppposed to shoe I got : error and when I click on it :
The href parameter must reference a valid Facebook user profile, but
"http://www.facebook.com/Entendu.info" is not a valid Facebook user
profile.
The link of the error
But the problem is that my url is totally valid !
https://www.facebook.com/Entendu.info
Thanks for your help
Well the answer is in the error itself -
The href parameter must reference a valid Facebook user profile, but "http://www.facebook.com/Entendu.info" is not a valid Facebook user profile.
you have to use a valid user profile and not the URL of a page.
One can not subscribe to a page in the same way that one can not like a person.
You should use a Like button or Like box in your app if you want to add fans to the page.
There is a different facebook embed code for PAGES and USERS
To subscribe to a Fan PAGE (usually organizations like cocacola, nike, I used it for participateHW)
http://developers.facebook.com/docs/reference/plugins/like-box/
To subscribe to a USER
http://developers.facebook.com/docs/reference/plugins/subscribe/
all the other social plugins are here (just read the description carefully):
http://developers.facebook.com/docs/plugins/

How do I specify the URL of your Facebook page in the href parameter of the button?

I have a like button on my website and I created it prior to having a fb fan page for my website. Now that I have a fanpage, I want to link my website with my fan page. How do I do that? It says:
Simply specify the URL of your Facebook page in the href parameter of the button
- but I have no idea how to do this.
I'd suggest starting from scratch since you cannot find your like button code. See https://developers.facebook.com/docs/reference/plugins/like/. Configure the like button to your desires, and copy the code from there.

Forcing Visitors to Liking Facebook Page

I have a Facebook page.
We will start a giveaway. And we will give gifts to our Facebook Fans . They will give a promo code if like our page. BUt we want to sure, they are really fan of our fan page.
Because of this, I want to create a new tab which say "You have to like this page for get promotion code" to user . When visitor like our page, he / she can see content tab. If not, they can't see.
It was easy on static FBML, but know how can i do it with iFrame ? My tab is ready. Created a new app and then this app added to page.
you need to parse the signed_request parameter, it has a Boolean attribute called liked.
you may want to look at this question

Facebook Fan Home Page Redirect

I speak any facebook fan page.
My aim is: I want to redirect "home (welcome) page of my fan", when i select facebook like button. Also, anytime i go to this fan page, again redirect home page. So, doesn't redirect fan wall page. So, home is main page. is it possible? (I know it is silly, but I want to learn it)
I think it is impossible. Facebook API lets you create applications which you have to launch. Adding events for I like button pressed is something that Facebook API don't let you modify.
I'm not sure I understand the question correctly...but if you are looking to subscribe to the "like" event, you can in fact do that:
FB.Event.subscribe(‘edge.create’, function(response) {
// do whatever you want after the like event
});

Facebook: any way to monitor when user clicks on Like button?

writing my first facebook webapp and i have some questions. I'm using their new Graph API + JS library.
The idea is that in order to use my webapp, user has to 'Like' facebook page A.
Suppose user is logged in. I have to check if he 'likes' page A. If user doesn't like that page, i display 'fan box' via
FB.XFBML.parse('<fb:fan profile_id="A's id" stream="0" connections="0" width="450"></fb:fan>');
Now, this fan box with 'Like' button is rendered in iframe that has src set to facebook domain.
Problem: i want to know when user clicks on 'Like' button so that i can display the rest of my webapp. The only possible solution that i can think of is polling every second facebook graph server which is really bad.
i can't attach 'onClick' event on that button cause it's inside iframe pointed to facebook domain (can't access it at all using JS)
i tried getting the contents of this iframe from my server and display it in iframe with empty src property so that i can access its elements - doesn't work, fan box is messed up.
There is no way that i know of to send 'i want to like that page' request to Graph server on behalf of the user.
I'm stumped. I really doubt that polling is the right way to solve this problem :)
You can get the onclick event by using the fbml code of like button instead of iframe code.
Facebook provides FB.event.subscribe which triggers when somebody clicks like button.
A complete tutorial is here.In your case you can write the code to refresh the page on like button click. and check for like condition on page load. so that if current user has liked the page you can redirect him to application page.