Custom like button how do you do it? - facebook

I have been using Flipboard for sometime. And on the the app their is a really customized Facebook LIKE button. How do I achieve this for my mobile web app?

"Like" is nothing but a connection available on different Facebook objects like "Albums", "Post" and many others. To create a like you need to issue "HTTP POST" on the click of the button or element you want to represent as a like button. For example to create a like on Album object using PHP SDK :-
$likeCreate = $facebook->api("/ALBUM_ID/likes","POST");
This creates the like for the user using the application through which this call was initiated and also requires publish_stream permission.

Related

Can't access ViewBag data in Facebook App

I have a Facebook app that is giving me fits. I basically have an app that once the user has liked the app, they can continue through the app. Using the Facebook Javascript API, it will see if the user has logged in, and if not allow them to log in. I pass rather or not they "like" the page from the controller, as well as their language (English or Spanish) to the view via the ViewBag object.
This works both locally and from the staging server; however I have to disable the like check in the view, but the language and like is passed in the viewbag.
I placed language in the view like
<p>The user's language is #ViewBag.lang</p>
and
<p>They like the page? #ViewBag.likes
Like I said, both locally and at the staging server it works; but nothing gets passed through to the Facebook app. I have a conditional check to see if the user likes the page in javascript like:
var likes = #ViewBag.likes
In Facebook, using the console I see that the data isn't passed as well as the before mentioned debugging I tried doing.
I am very new to MVC; is there something I need to enable to make it work through Facebook?
Thanks!
Well the issue is that the Facebook canvas sends an initial POST, this was hitting my POST instead of the GET which was setting these values. See here:
Does Facebook open a canvas app with a Post request? It's causing havoc with my MVC actions
Thanks!

Like an Open Graph action

I have created an application with their associated Open Graph actions, already approved by Facebook.
When a user publishes an activity/action in their feed, it's possible to "like" it from there. But is it possible to like it from another page, ie. with the "Like" plugin? by somebody who is not an user of the application?
Thanks
To like an action you need to have the user access_token or use the FB api for that
as described here: https://developers.facebook.com/docs/opengraph/actions/#like_action
This is how we do it:
FB.api("[action id]/likes", "post", function(response){...});
The like button works with a url, which is how facebook indexes pages.
Graph objects have urls which define them, and so you can of course put the url of a graph object as the url for a like button.
The graph actions don't have a url and so I don't think that you can attach a like button to an action.
I'm pretty sure that there's no way to like an action outside of facebook.

is it possible to "like" facebook fan page directly from iPhone app

is it possible to "like" facebook fan page directly from iPhone app using graph API?
There is no graph api method to have a user like a page (that would get abused). The only way would be to embed a Facebook like button inside a UIWebView.
The easiest way I have found is to use a UIWebView and either load the html portion of the LIKE code, or use an external .html document with the LIKE code. The only issues I have come across in this method is the user usually needs to login unless logged in from MobileSafari.

Facebook Video Like using custom like button

I am developing an iPhone application that lists videos posted on logged-in user's wall. I would like to provide an Like button below each video listed. When the user clicks on this Like button, the corresponding video should be liked in Facebook.
The Like button shown in the UI should match the UI theme of my app. I have gone through Facebook plug-in documentation related to Like button. Following is the link with the documentation:
http://developers.facebook.com/docs/reference/plugins/like/
But, I cannot use this Like button generated using iFrame since I will not be able to customize the look of Like button.
How can I customize my Like button? Or how can I programmatically like a Video URL? I am trying to this since long time. I have seen some iPhone apps already having custom Like button.
Take a look here for a nice how-to on styling:
http://www.esrun.co.uk/blog/disguising-a-facebook-like-link/
And the specific policy from Facebook is that as long as you are not deceiving the user, the policy team would consider this practice acceptable.
I could do it using Graph API. New SDK provides support for Graph API.

Create a Facebook "Like" programmatically?

I'd like to replicate the "Like" button functionality in an iPhone application using a native widget. The URL associated with the Like would be a product page with details on the manufacturer's website. Unfortunately, Facebook's Like Button [1] only supports the iframe version. Is there any way to have a user "Like" a URL without using the Like Button?
[1] http://developers.facebook.com/docs/reference/plugins/like/
There's no API to actually create a Like connection.
Looking at the Facebook Developer info, it appears it is possible to Like an Open Graph Object if it already exists in the Open Graph database. Look for the "/OBJECT_ID/likes" method under the "Publishing" section of the API Reference. It says you can "Like the given object (if it has a /likes connection)".
But I do not believe Facebook provides the ability to create NEW Open Graph objects (for, say, a webpage) programmatically. If anyone knows how to do this, I would be interested to hear about it.
There looks to be an assigned bug about not bing able to create new Graph Objects via the API: http://bugs.developers.facebook.net/show_bug.cgi?id=10714
We want to have our own "Like" system with an additional "Dislike" option, and if the user "Likes" something with our system we want to create a Facebook Like in the background. It seems we will need to pre-Like all of the objects (thousands of pages!) so this won't work for us. :(