How to tell if a user is a fan of the fan page - facebook

I'm working on a FBML fan page for a client. I need to perform a check to see if the current user is a fan of the page. I tried using the JavaScript API but I've found this is not compatible with FBML.
I have looked through the FBML page on the developer wiki and found checks for practically everything else but no is user fan check.
Any pointers in the right direction would be most appreciated.
Thanks in advance.

Try this instead:
https://developers.facebook.com/docs/reference/fbml/visible-to-connection/
Please don't make those "Become a fan 1st" pages with it though. They're basically spam.

Try this page:
https://developers.facebook.com/docs/reference/rest/pages.isFan/

This is a good article - for doing this task in fan page tabs (most easily done with the static FBML app).
http://thinkdiff.net/facebook/how-to-detect-fan-of-a-facebook-page/
Be sure to read the fine print - such as if you’re admin of facebook page, you all time see the fan restricted item and non fan restricted item.

The best solution is to parse signed_request. This method does not need app authorization by user.
$signed = parse_signed_request($_REQUEST['signed_request'], 'YOUR-APP-SECRET');
if ($signed['page']['liked'] == 1) {
$fan = true;
} else {
$fan = false;
}
Here is a guide to Check User is Fan of Facebook.

Related

Show text when user likes a FB page

We're trying to do some things on Facebook but to be honest we have no idea where to start.
We have a Facebook application which doesn't require any authorization. It's basically just a static page showing some of our information at the moment. We added it to a page as a tab.
We want to show some welcome text when a user likes our page. How should we go about this? I haven't used the Facebook SDK before so I'm completely lost.
Can we do this through the JS SDK? Check if a user has already liked our page and show a welcome message, otherwise show the like button? We're working with Heroku FB apps, not sure if that's important.
I'm not looking for complete example code, just some pointers would be nice.
Thanks in advance.
What you're looking for is a fan gate.
Here's a decent explanation:
http://www.hyperarts.com/blog/customizing-facebook-iframe-application-signed_request_reveal_tab/
$signed_request = $facebook->getSignedRequest();
$like_status = $signed_request["page"]["liked"];
if ($like_status) {
echo "You like us";
}
else {
echo "You don't like us yet";
}

Facebook Canvas Page Like/Non-Like Content

I would like to have my canvas page on facebook display different content for visitors that have liked and not liked yet.
I ran across this article but it uses FBML:
Facebook "Like" to see canvas page
It's my understading that facebook is phasing out FMBL support.
Does anyone know how to do this without using FBML?
Example?
Thanks for the comments. This probably won't matter since they're making everyone go to a timeline, the fangated pages are pretty much going away.

Facebook Page link to Photos?

Is there a way to link to the facebook photos tab of a Page via an iFrame loaded from a custom App (tab)? If I try to link to num?sk=photos, it gives me the "Go to Facebook.com" loaded in that iframe. I pretty much want a redirect.
Is that possible? Or does FB block link-ins like that?
Let me know,
Thanks!
I've been using javascript to set window.top.location.href = url;, but after reading Igy's comment, I think I'll be switching to target = _top
I think you should check out facebook developer page.
You can use GRAPH API to access photos, photo albums, profile pictures unless any user has different privacy setting.
You might want to check out GRAPH API for that, I hope it might help you to get started.

Facebook fan page iframe share button

I just start on creating fan page on facebook. Left hand side of the fan page, there is a "Share" button which is sharing the current fan page.
I saw that it's url is: http://www.facebook.com/ajax/share_dialog.php?params
When i try to use this, it's failed. Is there any method can use this or simulate this function, allowing me to share the fan page?
Thanks to all in advance.
I know this thread is basically dead, but it still comes up in Google, so I figured I'd answer it. This is possible using Jquery and the FB Javascript API.
http://fbmhell.com/2011/07/facebook-share-popup-iframe-tabs-jquery/
Check out http://developers.facebook.com/docs/reference/plugins/like-box/
You can use the method I describe here : How to make custom share buttons
It works in page tabs.

Facebook Check if user "Liked" the page

I made a few Facebook FBML Canvas pages (Facebook considers these to be Applications) for a company, and they requested that users who "Like" the page would be redirected to another page, or the page will display different content with AJAX.
I went through the Facebook Developers Documentation, but I can't find a clue on how to do it.
I'm sure someone has done it before, any suggestions?
I found this on the Facebook forum I think it might help you out!
How can i redirect when someone like/share?
I haven't tried it myself though!
Good luck!
You can use either the JS or PHP sdk to check if a user liked a page. See examples below...
Uses JS sdk to check if a user liked a page (can be any page, just set the page id). This can be used in a standalone app or from within a page tab. - http://unbound-media.com/facebook/how-to-tell-if-a-facebook-user-likes-your-facebook-application/
Uses PHP sdk to check if a user liked the page from a tabbed app (can only check if user liked the current page they're on). This method can also be converted to JS. - How to check if a user likes my Facebook Page or URL using Facebook's API
If you are dealing with facebook app tab page, the following code helps you to find isfan status
$signed = parse_signed_request($_REQUEST['signed_request'], 'YOUR-APP-SECRET');
if ($signed['page']['liked'] == 1) {
$fan = true;
} else {
$fan = false;
}
Visit this link for demo and source code.