I am trying to figure out if I can give somebody a "sharer" link where they click on it and then make a post to facebook. After they have posted, I wish to be able to verify that this post has not been tampered with or at the very least deleted, lets say 2 weeks from the time it was posted. Is there a way to programaticaly check if the post still exists and get the content of that post?
I know I can do the first part with some javascript such as this:
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/etc...";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
However, is there a way for me to check that what this user has posted still exists after 2 weeks?
This would only be possible by authorizing a user with the publish_actions permission. After that, posting something with the FB.ui dialog will return the post ID in the callback function. Of course you could also use /me/feed to post something then.
But authorizing a user just for this is pointless, it is not allowed to "incentivize" sharing, as you can read in the platform policy. So you are not allowed to reward the user for sharing in any way. Users need to share something because they really want to.
Also, you would never get through Login Review with this, so it´s actually impossible.
Related
Facebook enables you to have both friends and followers on the network. Friendship is a two-way relationship -- you can see the updates of your friends, and they can see yours (depending on the privacy settings configured for each post). If you follow someone, this is a one-way relationship: You can see the user's public updates, but that individual doesn't see yours.
i have my own id where new people add me as friend but i on follow option. so new user follow me.is there any way i can get followed number in php.
very thank for luschn helping me
well i found its solution it was very easy hence Facebook doc / FQl not supported this function but getting number of followers is very easy
just
https://developers.facebook.com/docs/plugins/follow-button
my recommendation visit above line mention code is for sample only
Your Plugin Code
Include the JavaScript SDK on your page once, ideally right after the opening tag.
(function(d, s, id) { var js, fjs =
d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js
= d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs); }(document, 'script',
'facebook-jssdk'));
Place the code for your plugin wherever you want the plugin to appear on your page.
your
profile id place here(you can view this click on your profile copy
url) "
data-layout="standard" data-show-faces="true">
I am attempting to use the share button on http://www.desiringgod.org/ on a Mac. It works for me on mobile, and on a desktop, the sharer dialog comes up properly. However, when clicking the Share Link button, dialog shows a short Facebook status bar and then does not respond. After inspecting in the browser's dev tool console, I see an 500 error.
Here's what I see in Firebug.
"POST https://www.facebook.com/ajax/sharer/submit_page/ 500 Internal Server Error"
"NetworkError: 500 Internal Server Error - //www.facebook.com/ajax/sharer/submit_page/"
Is anyone else experiencing this issue? Any ideas on how to resolve?
It seems like a FB issue, but I can't find much else about this online or on FB forums.
Thanks!
I had the same error and realized I was using a wrong app id. I'm not an admin of that faulty app id, so I don't know whether it was some settings in it (perhaps sandboxed) or something else. But changing it will definitely solve the issue for you
This seems to be a bug on Facebook's behalf - as their Like button plugin doesn't require an appId and their Share Button code-generator doesn't include any references to it being required.
That said I've found a workaround that doesn't require signup/AppID-registration.
What I did was simply to copy any existing AppID and stuff it at the end of the sdk.js URL, Like so:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0&appId=XXX";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
(The one I used in place of the "XXX" above, was an App ID from one of Facebook's own sites.)
There seems to be no validation being performed, which again leads me to believe this is a temporary blunder made by Facebook.
I've created a Facebook App and am using the FB developer tools to share content on a site.
However, when a link is shared it is titled "xxx shared a link via Widget Share Log App". I've seen other sites change this to read something like "xxx shared a link via Irrawaddynews" and I wondered if it was possible to do the same here.
BTW, I'm initiating the Facebook SDK with the code below (as per the instructions here: "shared a link via Widget Share Log App." - but this didn't solve my problem).
window.fbAsyncInit = function() {
FB.init({
appId : '{MY_APP_ID}',
status : true,
xfbml : true
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
In your App ID settings on Facebook, there are a few fields you have to update. We wrote pretty detailed setup instructions for doing this in conjunction with our own share software, but there's a general section beneath that for setting up the Facebook app:
https://naytev.zendesk.com/hc/en-us/articles/202777178-Link-Naytev-to-Your-Facebook-App
#userfuser - you actually don't need their validation, you simply need to make the app active. The process has a pretty terrible UX, and missing fields like "support email" will cause you to not be able to activate without a helpful error message.
http://www.independent.co.uk/ and http://www.guardian.co.uk/ have an application where by if you read an article on their site, it writes to your profile/timeline that "X has read Y on Z".
Now I can write to the timeline with a button present. I can also do it automatically (but this happens each time they go to the article which I don't need). However what I need to add is some logic as shown below
If user logged in but app not authorised
Show a button to authorise application
If user logged in and app authorised and visiting article for first time
Automatically publish "X has read Y on Z" to their profile and FB
If user logged in and app authorised and visiting article again
Don't publish anything
Does this make sense? Any examples of this around? So basically pulishing to the timeline isn't an issue, it's just the various checks I need to put into place.
EDIT
Ok, for some reason this works (for checking of they are authorised or not) but if I take out the alert('test'); part, it doesn't work. Any ideas?
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=123456789";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
alert('test');
FB.init({
appId:'123456789', cookie:true,
status:true, xfbml:true, oauth:true
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
alert('Logged in and connected');
$(read);
} else if (response.status === 'not_authorized') {
alert('Logged into FB but not authorised');
} else {
alert('Not logged into FB');
}
});
</script>
Ok, got it partly working. There are some slight niggles but main issue now is to check whether they have posted a specific action to the timeline already. If they have then don't post another e.g. So when they go to an article first time, the status "Jon has read an article on the Site" gets added. However if they go to it again, it doesn't get added
This is against the Facebook Platform Policy. See section IV part 3:
If a user grants you a publishing permission, you must still obtain consent from the user before taking any action on the user's behalf, such as publishing content or creating an event.
You can not post to the user's timeline\wall without first asking them permission. The Independent and The Guardian have a unique arrangement with Facebook that exempts them from these restrictions.
This is the kind fo thing that will get you a strongly worded email warning, or more severely, a developer account suspension.
Its always good to have a look at the Platform Policies and Promotions Checklist before starting a new project.
Your code only works with the alert due to a race condition in your code.
You are loading the SDK asynchronously (which you should), but then try to use it synchronously by calling FB.init immediately.
You need to define a function fbAsyncInit, in which you call FB.init. This will ensure that you don't try to call FB.init before the SDK is loaded.
Other than that, this is all about getting the right permissions from the user, and following Facebooks policies. Technically it's all pretty basic stuff.
I currently have the following situation. On my website, the user can access his settings page. This page features a tab called 'Facebook'. On this page, I have the following code that lets the user allow my website to post to his timeline when completing a certain action:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#appId={APP_ID_HERE}&xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-add-to-timeline" data-show-faces="false" data-mode="button"></div>
When the user clicks the button, it is forwarded to the Add to Timeline dialog. When the user clicks Allow, the user gets redirected back to his settings page on my website.
The question is; how do I get an access token out of this? I need a user access token to post to his timeline, according to this line from the tutorial:
https://graph.facebook.com/me/YOUR_NAMESPACE:cook?recipe=OBJECT_URL&access_token=ACCESS_TOKEN
Just tell user to get log in
<fb:login></fb:login>
and after that, use this code everywhere you want
FB.api(
'/me/NAMESPACE:cook','post', {recipe:'http://samples.ogp.me/214706465259448'},
function(response) {
//posted
});
Where cooking is an object