Check if visitor of my website likes a facebook page - facebook

I am in the process of making a band website. I have a download of a song but I want it only to be available to the user if they have liked the bands Facebook page. I am aware there are similar questions to this already on here. I have tried some of them and they don't work, also none of them are very clear. Thank you for your help.

There are more than enough results which answer your question, for example Create Like-Gate for page
The most simple way to create this is using a Page Tab app (https://developers.facebook.com/docs/appsonfacebook/pagetabs/) and parsing the signed_request (https://developers.facebook.com/docs/reference/login/signed-request/) Facebook is sending when the page Tab is accessed.
The page object within the signed_request contains a field called liked which indicates whether the actual user liked the Page or not.

Related

Facebook page apps - liked and unliked

I know that this has been covered in various ways before - but is there a way to display one set of content on a page for liked users and another set for people that don't like it.
This approach (http://www.uksitebuilder.net/2011/05/create-facebook-secret-fan-page/) only seems to work the first time you hit the app, so it's not good for returning visits.
I've google forever but it's very hard to find a up to date / current solution.
Any help would be greatly appreciated.
It's all in the docs. Simply parse the signed request in your Tab and read out the page.liked property. It's true if the user liked the page and false if not.
Edit_: After seeing your comment, just save the "liked" state in a session variable. You should then use the JavaScript methods provided by Facebook to check if the user liked the page while browsing around in your App. You could then reload the page for example. You can read about FB.Event.subscribe in the Facebook JavaScript SDK docs.

Like button for Facebook page shows generic Facebook description in News Feed

I want a Like button on my web site that Likes my Facebook profile (rather than my web page), so that when a user clicks it they subscribe to my Facebook posts.
I've created the Like button using the tool at https://developers.facebook.com/docs/reference/plugins/like/
Further down that page there is an FAQ entry:
Can I link the Like button to my Facebook page?
Yes. Simply specify the URL of your Facebook page in the href
parameter of the button.
So, I've edited the href parameter to point to my Facebook page. eg:
https://www.facebook.com/myfacebookid
When a user clicks the Like button it has the desired effect. The user ends up having Liked my Facebook page. This is easily verified by the user going to my Facebook profile and checking that the Like button has changed to Liked.
But. When the user clicks the Like button, and entry appears in their News Feed with a generic Facebook description. ie:
Facebook is a social utility that connects people with friends and
others who work, study and live around them. People use Facebook to
keep up with friends, upload an unlimited number of photos, post links
and videos, and learn more about the people they meet.
I don't want a generic post about Facebook to appear. I want the description to relate to my Facebook account and/or web site.
Normally, I could modify this behavior with the Opengraph og: description tag, but as the page in the href is a Facebook page and not my own, I can't control the Opengraph tags.
I'm pretty sure that this was working okay before I enabled timeline for my account, so maybe this is a timeline bug?
So, how do I add a Like button which a) Likes my Facebook profile rather than one of my own web pages, and b) Posts a description of my Facebook profile rather than give a generic Facbook description?
Are all your fields in the info part of your page filled in, and/or completed? I just tested your theory and it seemed to work as expected, only thing is I know all fields in "info" are filled it. Give that a try.
This may happen if you have filled invalid/incomplete/wrong og tags in past and later changed them. Facebook's cache creates problem sometime.
Try putting all the entries (i.e. all og tags) and then debug them here http://developers.facebook.com/tools/debug. This debugger gives a detailed info about the url with og tags and also clears the cache for you.
This should solve the problem.
You have 3 important fields that used on page opengraph: Name,Description,Profile Image.
They are used when some one post your link on Facebook, or Google or some else web service that handle opengraph.
Actually, the suggested answers currently do not work and there is an open bug / ticket on Facebook for it. Up to now, there's no fix.
The problem is that you can not use simply https://www.facebook.com/myfacebookid. You should copy and paste the exact page URL. If you have a low number of likes it would look something like https://www.facebook.com/pages/[YourPageName]/[Your page Id]/, and this is the URL that you should use at this point.
If it does not work, try also https://www.facebook.com/[YourPageName]/[Your page Id]/.
In short, copy-paste the URL, do not type it manually.

How to prevent others from using my facebook application?

I just created a Facebook application that basically creates a new Tab on my Facebook-profile-page and loads contents from my website in an inline frame. Now I got to the point that I added the application to my profile page with a simple link like http://facebook.com/add.php?api_key=APP_ID&pages=1. But how can I prevent others from just doing the same and using my app on their pages then?
Thanks in advance!
Aha! You know the page that it is supposed to belong to, so hard code that in your app's code and you can check the page id coming in from the signed_request and see if that page id is yours. If not, send down not permitted in your response HTML. If it is your page, then response down the good HTML. :)
For more information on signed_request see: https://developers.facebook.com/docs/authentication/signed_request/

Having a issue with the "Share" feature Facebook Fan page

My friend has created about 20 Facebook fan page for the website. www.AvailDiscounts.com
Now the issue is, when we click on the wall post to "share" with other friends, its taking to another page where it displays the meta tags and the title of the login page instead of displaying the exact post.
Please find the fan page of the website:
http://www.facebook.com/pages/Avail-Discounts-Chicago/195486540483072
How to over come this issue.
The Query can be found in the following link with images:
http://getsatisfaction.com/rssgraffiti/topics/issue_with_share_button_when_using_rss_graffiti
Please help
As far as i have checked this seems to be an issue with the RSS Graffiti application in Facebook.
You have two issues here:
1) Are you posting the correct link in RSS Graffiti?
It seems all of your fan page links redirect me to the Avail-Discounts-Chicago home page. It's either it is non-existent, deal closed or bad URL supplied.
2) RSS Graffiti posts differently than Share button
RSS Graffiti prepares your data, image link title and description before posting to the page stream. The default Facebook Share button does not. What it does is get the URL, scrape that URL with information, which can be defined through opengraph tags. Make sure your links / deals have their meta:og's.
Your question is a bit vague, and the passing of the auth information is kind of scary, but anyway, I'd make the href of the post something along the lines of this:
http://www.facebook.com/dialog/feed?app_id=123050457758183&link=http://developers.facebook.com/docs/reference/dialogs/&picture=http://fbrell.com/f8.jpg&name=Facebook%20Dialogs&caption=Reference%20Documentation&description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&message=Facebook%20Dialogs%20are%20so%20easy!&redirect_uri=http://www.example.com/response
More information is available here:
http://developers.facebook.com/docs/reference/dialogs/feed/

facebook landing page

i have one problem with facebook landing page. i created facebook landing page through static fbml app but i have one problem with like button, user must like the page before he will navigate to another page.
i want to do same functionality in my landing page,
http://www.facebook.com/BusinessofCinema?v=app_6009294086.
anyone know about this please help me .
thanks inadvance......
At this point you'll probably want to go with iframe based Facebook page tabs instead, now that these have become available and fbml based apps are being phased out. Among other advantages, the signed_request parameter that Facebook sends to an iframe based tab app includes a flag that indicates whether the user is a fan of the page.
Now that iframes are the only way to create new Facebook apps and FBML is being phased out, you need a new way to do it.
When your app URL is loaded, it is passed a signed_request POST parameter. This parameter contains the information you need. However, it is packed and encoded so it requires some manipulation to get the right info out.
First, split the signed_request on the '.' character. The first part is the signature. The second part is the encoded_data
Decode the encoded_data into a JSON string using the URLBase64Decode function equivalent in your server-side programming language
The JSON object contains a node called "page". This contains a node called "liked".
If "liked" is true, the user liked the page and you display the "liked" version of your app. If false, show the "Please like me" version of the site.
The FBML way will continue to work the way you have it live right now, but for anyone building a new Facebook app, this is the way to do.