Facebook social features on iframe app - php

We are developing a facebook iframe application that pulls some images (via an API) to the current user album (creates a new one).
The user views his newly uploaded album photos using a facebook lightbox clone. In this clone he must be able to comment and like the current viewed photo.
Is there a way to provide facebook comments & like to these pictures without the use of the Graph API (which would require us to replicate a lot of visuals).
Another try was the social plug-ins with the facebook photo url given but no success.
Any ideas?

I would recommend using the social plugins that facebook provide.
For the likes and comments you can specify a URL in the plugin code, that URL should be the URL of the photo relative to your app e.g. http://myapp.com/photo/123 and not the http://app.facebook.com address.
Facebook will need to be able to crawl that URL so if you are checking if the user is logged in via PHP then you should either disable this if the user agent contains facebookexternalhit or show a different page for that user agent. It doesn't matter about the content, just set a couple of og: meta tags and that should be fine.

Related

Is it possible to display Facebook users timeline on website?

OBJECTIVE: I need to display latest 5 entries from users timeline on website, using PHP.
Please not that i speak about timeline of user profile - not fan page, not group.
SO FAR I DID THIS:
Registered as Facebook developer
Registered app
Obtained token
Opened url: https://graph.facebook.com/USER_ID/feed?access_token=MY_TOKEN
Voila. Feed of that user is displayed now, but..
PROBLEM: So now i have users feed, but it looks like its partially working.
It happens often that it don't displays some updates, sometimes it displays just date of the post and not the content.
However when i try to grab feed from some facebook fan page, then everything work normal.
MY QUESTION: Are we allowed to grab user timeline? If yes, what im doing wrong?
You won't ever see all the information that is visible inside the Facebook app via the api. This comes from how Facebook filters out the data. See this Facebook Developers blog post for more information: https://developers.facebook.com/blog/post/478/
Yes you are allowed to to grab user timeline posts, even with a limit, if your app asks for read_stream permission. Issue an HTTP GET request to the below URL:
https://graph.facebook.com/user_id/posts?access_token=token&limit=5

Show website activities on Facebook timeline?

How can I show website activity on the Facebook timeline?
I integrated Facebook API and Facebook Connect. Now, if any new user uploads a video on the website then I want to display this activity on the Facebook log. What function of Facebook API can I use for this?
You should use Open Graph Actions and Objects. I recommend you create:
A video object
An "uploaded" action as well as utilising the built-in "watch" action
There is a full and more than helpful tutorial right here. Things to consider:
You need to request publish_actions permission from users of your website, if you are already using Facebook Login, then this is a simple matter of adding it to the list of Permissions that you are requesting
Publish an uploaded action for every new video uploaded, make sure you get explicit consent from the user to do so, so that you can use the fb:explicitly_shared parameter.
Use the watch action for any videos that people watch on your website.

Facebook like button and OAuth Access

I am connecting to the Facebook API using HybridAuth on the server side (backend is written in PHP). This is for a SaaS publishing application that is hosted on our servers. I understand the mechanics of OAuth and that once I accquire the appropriate permissions from the user, I can write and read from the Open Graph API, which in theory will allow me to do almost anything.
The problem is that I would like to use some of Facebook's social plugins. In particular, I would like to implement the like button so that it automatically appears for each blog post, article and page.
The problem is that the like button and the various Facebook plugins require an app_id. I would prefer not requiring users to add the developer app to their account and creating an app to get an app_id as it can be a confusing process for non-developers.
Is there anyway we can create or retrieve an app_id from open graph (which we can store and use to generate the like buttons and other facebook widgets)?
With the migrations, I understand that each liked URL will not have it's own page. Once the user clicks a like button on your site, he automatically likes your page. However, let's say I have a page called http://www.mystore.com/products/some-awesome-product and there are other similiar pages, all with a like button. Is it possible that when clicking like, the user automatically likes our Facebook page, but when an item is published in their news feed for the like, the URL links to that specific product? Effectively, is there a way for users to like multiple pages from my site?
Update: It looks like we can generate app_ids programmatically with the create application API in the legacy REST API. However, this does not seem to be an option with the graph API.
Seems like we cannot programatically create an app_id for an account. This is not an issue, as we will just create a small guide to guide our users through creating an app and submitting the app_id to us using a form. Not perfect, but should be easy to implement.
As for URLs, liking something will not automatically like your Facebook page. If href is blank, the current page will be liked. If you set your facebook page in the href parameter, then your facebook page will be liked.

Facebook Cover Photo API using PHP

Has Facebook released any api for facebook cover photo?
I want to implement it using PHP language.
EDIT
I want to upload cover photo in facebook timeline using graph api PHP
There is an api for updating the cover photo on a page
http://developers.facebook.com/docs/reference/api/page/
It asks for a photo id which i guess is the id of a photo from the users album.
Actually, it is not possible to change the profile picture directly via Facebook Photo Graph API as no section mention about that.
However, we can do a trick by uploading user’s photo to Facebook via the API then redirect the user to uploaded photo URL with 1 added in querystring parameter as below:
http://www.facebook.com/photo.php?pid=xyz&id=abc&makeprofile=1
“&makeprofile=1″ is the main thing here and xyz/abc will be returned by Facebook. By adding the parameter, Facebook will auto change the profile picture of the current user with the uploaded picture above.
For more info:
http://4rapiddev.com/facebook-graph-api/php-change-facebook-profile-picture-with-graph-api/
You can upload photo to an album via graph api. Get the new photo id and redirect user to this url
"http://www.facebook.com/profile.php?preview_cover=" + photo_id
before that, you should inform the user that he/she will be redirected to facebook to page where they can set new cover photo (they need to confirm the change, click the save button). It's not perfect solution, and not fully covered api but it's best way out there asfaik.

Facebook comments on my website

I had a movie related forum in my website. There is a commenting system for each movie and artist. Simply users can add comments.
Now I would likes to implement facebook commenting system to my application . My little worry is how to implement all these two ( fb and my own system )?
Also I had a doubt ..
If I put / share the link on this site on the facebook and assumes that users commented inside facebook .. Then there is any option to print that comments in my web site in that page?
Facebook comments is a social plugin that could be embedded in your web page. Specifically it's implemented inside an iframe. Since that iframe is implemented on facebook so you don't need to worry about how to generate the content. Although it looks like appear in your web page.
However if you do need to access the comments data (programmatically), you could retrieve the comments via facebook graph api: https://graph.facebook.com/comments/?ids={YOUR_URL}. You can also subscribe facebook events to get aware when someone has commented on your movie.
Ref:
facebook comments plugin: https://developers.facebook.com/docs/reference/plugins/comments/
facebook event subscription: http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

Categories