Photos uploaded to page as user are invisible to others - facebook-graph-api

I have successfully uploaded photos to a Facebook Page that I am not the administrator of using the iOS FacebookSDK. However those photos are invisible to everyone except the uploader.
The page has the "Everyone can post to Page's timeline" and "Everyone can add photos and videos to Page's timeline" settings on.
I am using the following code, where self.photo is a UIImage:
FBRequest *request = [FBRequest requestForUploadPhoto:self.photo];
request.graphPath = #"<pageid>/photos";
request.session = [FBSession activeSession];
FBRequestConnection *conn = [FBRequestConnection new];
[conn addRequest:request completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { ... }];
[conn start];
The upload / post is successful. If you view the page in question, as the user who uploaded the photo, you can see the photo on the page in the "Recent Posts by Others" box.
However, if you view that page as another user - no activity appears on the page and the "Recent Posts by Others" box is empty.
If that other user then uses the app to upload a photo in the same way, the same thing happens to them: they can see the photo they've uploaded but the first user cannot.
All photos uploaded by either user show to that user as "Shared with: Public" and "via" the application used. So it doesn't appear that they are hidden because of privacy or something like that.
I have seen many others post that they have been unable to upload photos to a page as a user (not the administrator of the page), e.g.:
Posting Photo to facebook fan page via iOS app by regular non-admin users
http://facebook.stackoverflow.com/questions/10795769/upload-photo-to-fanpage-from-application-user
http://facebook.stackoverflow.com/questions/7140097/facebook-create-app-for-page-to-upload-photos-to-pages-photo-album
http://facebook.stackoverflow.com/questions/12897746/user-image-upload-to-page-gallery
I have been able to upload the photo, but it only shows to the uploader! Is this some functionality that has changed? Am I running into a bug? It's very strange, I would love it if someone could shed some light!

Unfortunately it appears that while the Facebook API allows you to get further, it does still not work to upload photos to the timeline of a page.
This bug appears to be related and has been open for a while:
https://developers.facebook.com/bugs/246002638848837/

Success! It works, I have posted as a user to a Facebook page.
Where self.photo is an NSData:
NSDictionary *parameters = #{#"test.jpg": self.photo, #"message": self.message};
FBRequest *request = [FBRequest requestWithGraphPath:#"<pageid>/photos" parameters:parameters HTTPMethod:#"POST"];
Then the rest as per my question above.

Related

Accessing URL in 'get' method of view

I want a web page (with the url page3) to be displayed differently depending on whether a user on my website is redirected to it from the pages with urls page1 or page2.
How can I access the full url (not just the query parametres in it) from which the user was redirected in the get method in the view associated with the url page3 ?
After reading the docs more thoroughly (thanks for the tip Brandon!), I found request.META['HTTP_REFERER'] did the trick.

Create post-forms such as craigslist on my Django powered website

I'm creating a marketplace website such as Craigslist. I'd like to make "post-forms" for users to post their own product information (by uploading photos, adding forms (name, price,condition,,etc.)) on my website' category-page.
Now, I think I can do these things by making use of "Django Permission", but is it correct? If so, how can I do that? Or if not, there are other ways to allow users to do these things ?
The short summary of my website is like below. Specifically,I'd like to know how to allow people to post their products on the category page.
Register & Login
You would have several categories such as furniture, books, games,,, and then, click one of those categories. (I've created this category-page by using "Django admin")
(eg. )
http://bakersfield.craigslist.org/
Then, you can see what kinds of goods are sold on that category page. And then, At the top of website, you can find "Post" button to post our products on the top of my website.
And after click it , you can find "Posting title" "Price" and "upload photos" and many other forms.
(eg)
https://post.craigslist.org/k/7v...
4.After filled those forms,then click "submit" button to post your products pages' link to category page.
Craigslist is the best example for my website.

How can I place a comment in Facebook Open Graph API post?

I create posts using Facebook Open Graph API with custom action. These posts are displayed in Timeline with caption "User Name added a visit..." ("add" and "visit" are my custom action and object), then a block with image, title and description.
I create a post sending HTTP POST request to Facebook with only a link to page. Facebook fetches data from this page from meta tags og:type, og:url, og:title, og:image, og:description.
I want to place a text between caption "User Name added a visit..." and image. How can I do that?
Use 'message' parameter in your open graph call. The text in this key will be shown in the place where you want.

like detail page inside timeline page tab

I have a facebook timeline page tab app that's running inside an IFRAME on a fan page.
On the main page of the app, we show 10 jobs and users can click through to the detail page of one single book.
We want to add a LIKE button on those detail pages, so that users on facebook can like and share that job in their stream.
The app is totally dynamic so different customers can install the app on their fan page and list their own jobs. (ex. coca-cola installs it on his coca-cola page and lists jobs within the company. then microsoft installs it as well and does the same)
The problem concerns og:metatags and redirection of the liked detail page link, right inside the right facebook company page and relative right detail page showing the job.
I can get these two things done and working but not at the same time:
A. Facebook gets correctly the og:metatags in the head section, with image, title, description when I use the following implementation of the like button (without "data-href" extra attribute)
<div class="fb-like"
data-send="false"
data-layout="button_count"
data-show-faces="false"
data-action="like"
data-font="arial">
</div>
The problem is that not specifying the data-href attribute (and the og:url meta is totally ignored) this is gonna create a link to the current page => intended current page inside an iframe => so the result will be that when you click the shared job on facebook you will be redirected NOT inside the facebook app -right page -right detail page, but to the detail page on the server that hostes the app.
B. If I instead specify the data-href attribute
<div class="fb-like"
data-href=<%= "http://www.facebook.com/pages/:page/#{session[:fb_page_id]}?v=app_XXXXXXX&app_data=#{#job_details.job_id}" %>
data-send="false"
data-layout="button_count"
data-show-faces="false"
data-action="like"
data-font="arial">
</div>
Doing this I can get the right link posted on facebook (so then using &app_data attribute) I can get the perfect redirection working.
BUT on the downside, the og:metatags are totally ignored and instead facebook picks the page tab metatags (top iframe that hostes the pagetab app) and so I get posted on facebook a crap link that tells about a page on facebook with the page app picture. And the even bigger downside is that when you like a job on the app, all the jobs appear to be liked as well (basically the iFrame app becomes the liked page... instead of being the job detail page picked as liked page)
Is out there any genius that knows how to sort this out? I need to get the A an B working at the same time to get the requested result!!!!
Please help!!! :(
I've found the solution myself.
Like button => use href and ref attributes, especially put on the ref the id of your facebook fan page. Passing the current page url will also load and share correctly the og:metatags.
<div class="fb-like"
data-send="false"
data-show-faces="false"
data-layout="button_count"
data-font="arial"
data-action="recommend"
href=<%= "https://app.com/jobs/job_details.job_id" %>
ref=<%= FB_PAGE_ID %>>
</div>
Once you pass the ref attribute to facebook, on your wall the link will be posted by facebook with an extra query string appended with in particular the "fb_ref" parameter:
for example a button with parameters:
href=<%= "https://app.com/jobs/job_details.job_id" %>
and
ref=<%= 332325142248470 %>
becomes:
https://app.com/jobs/a0Ed000000a54bkEAA?fb_ref=332325142248470&fb_source=profile_multiline
when the user clicks the link we want to be redirected back right inside the correct page tab app and right job details page. To achieve this we set up into the controller/show action (that in ruby corrisponds to controller_name/id) a new redirection, remembering that ref will put inside a query string after our href link:
if params[:fb_ref]
redirect_to "http://www.facebook.com/pages/:page/#{params[:fb_ref]}?v=app_xxxxx&app_data=#{params[:id]}"
end
As you can see we create a new dynamic url that will use the "app_data" parameter of the facebook "signed_riquest" (http://developers.facebook.com/docs/authentication/signed_request/) in order to pass to our application the right detail page to be visualized and also redirect us to the right facebook page.
once done this we have just to manage correctly the new app_data parameter that comes now with the signed_request. In my case in one of my main controller I've used:
if fb_signed_request[:app_data]
redirect_to "/jobs/#{session[:app_data]}"
end
And we will see our app loading the right page and the right job detail page!
Hope is gonna help other people!

Facebook: Change the description/title that appears in a facebook post when I post a URL

I am using a PHP script to post a URL to a fan page that I am an admin of, but the contents of the post always appear as defined by page's <title> tag/<meta type="description"> tag.
Can't the contents of facebook post be changed by using facebook's open graph description(og:description)/title(og:title) tags in the page being posted?
The title can be changed using og:title as long as the page has less than 50 likes (otherwise it is locked in by Facebook). The og:description can be changed at any time.
See: https://developers.facebook.com/docs/opengraph/