wordpress frontend posts to automatically post on user's facebook timeline - php

Can someone please give me some hand on how should I setup this flow on my website:
User is already connected to the site with facebook connect with these permissions: email, read_friendlists, publish_stream, publish_actions. And that all works fine.
User submits an article from frontend in wordpress successfully.
What I want to do is when add_post() action is triggered (using custom theme) and successfully submits article in wp, I would also like to post the same article to the user's fb timeline.
Believe me I've read all the darn documentation in FB dev but no straightforward example on how I could do that.
They mention using curl to graph api , but how to use it? With php or javascript? Maybe you will have any working example cod so I could have a look?

Related

Is it possible to add a post on a facebook page via the graph API without a Facebook App?

I want to post updates automatically to my facebook page from my PHP website.
Facebook seems to force me to create an App where users can login and then post stuff.
But I don´t need all that stuff, I just want to post to the facebook page directly via code.
I went "Ok, I´ll create an App", but now for them to give my app the needed permissions, they want me to give them a login so they can test my app and stuff ... Is there no simple way to just autopost something to my own Facebook page?

PHP Facebook SDK publish posts in Fan Page

I have created an account in Facebook Developers, and I've generated the token with long live (never expire). I've correctly published the post with my script PHP. The problem is that the only person who can read it is me. It isn't published in my Fan Page. It is neider published in my personal profile. It is in an intermediate point between my personal profile and my Fan Page.
The app created in Facebook Developers is active and published. I just want to publish my blog posts in my Fan Page.
The permissions configured in my Access Token are: manage_pages and publish_actions. I have in another platform and it works perfectly. Can you give me any suggestions? Thank you in advance.
Your app is not made public yet (check app dashboard, Status and Review tab, “Do you want to make this app and all its live features available to the general public?”) – as long as it is not set live, all content created through it will only be visible to you.
You always need to do this for each api key.

facebook api - retrieve all tagged friends photos

I'm never used facebook api yet I saw on a blog a piece of code I could use for. It retrieves all tagged photos of our friends and downloads them.
http://www.shelldaemon.com/2014/01/bypass-facebook-photo-verification.html
Yet it is not working since I login, accept the app permissions and it takes me to the login page again. Is there any problem in the code I can fix? I know about php, yet I don't know anything about facebook api.
It would be awesome if someone can see what's the problem.
Thanks in advance.
Which login pages does it take you back to? The Facebook login page or your custom login page? In fact the custom login page would be great since the flow of the app is:
Custom login page on local webserver => Facebook-App login page => Download your friend's tagged photos => Custom login page again.
Maybe the code is working but the part where the app is supposed to download is skipped because of missing file permissions (write-permissions to your destination folder) e.g.?
Did you try to inspect what is going on in your browser after you logged in and before you are redirected to the login page again? With Firefox and Chrome you can inspect the website / web application and look at the console there for errors.
You could also try to add some debugging information during download (e.g. add an "echo 'friendname'" into the download-loop.
Hope that helps!

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

Application able to post on user's Wall

I have a Fan Page and I need to post something on users Wall after clicking Like Button. Moreover I need to display different content for users who "Like" the page and for users who don't "Like" the page. Is there an application like "Static iFrame Tab" which already solves this? If not, then how to post something on users Wall? I downloaded the facebook.php file, but I haven't managed to find the required function there.
The user's 'like' status can relatively easily be returned by decoding the signed request sent by Facebook to the page.
I've built a simple fan/like gate that is available over on GitHub - it might help you get up and running.
With regards to posting to the user's wall. I would suggest using the Javascript SDK and reading the FB.ui documentation over on Facebook.

Categories