I have created Read button for publishing actoin on facebook timeline using opengraph! So when user click the button the activity is posted on thier timeline! My question is how to remove read action for specific posts? Like on mashable facebook app there's one button giving right to share or unshare read!
<script type="text/javascript">
function postArticle()
{
FB.api(
'/me/news.reads?article=<?php the_permalink() ?>',
'post',
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Successful! Action ID: ' + response.id);
}
});
}
</script>
I am using above code for share read button. How to create button for unsharing read
When you successfully post a news.reads action, the Graph API will return an object of the form
{"id": "ACTION_ID"}
If you want to allow the user to delete the action you can then perform an HTTP DELETE on
https://graph.facebook.com/ACTION_ID?access_token=USER_ACCESS_TOKEN
Code to do this would be:
<script type="text/javascript">
function deleteAction()
{
FB.api(
'<?= $actionID ?>',
'delete',
function(response) {
alert('action deleted')
});
}
</script>