For the life of me, I cannot find a way to delete, cancel or remove facebook events I created & updated using the FB PHP SDK & the Graph API.
I've tried every single permutation found on facebook's documentation & stack overflow...
Here are some of the clues I have found on my quest..
https://developers.facebook.com/docs/reference/api/#deleting https://developers.facebook.com/docs/reference/api/event/ https://developers.facebook.com/docs/reference/rest/events.cancel/
Facebook SDK and Graph API Comment Deleting Error
Facebook API - delete status
Facebook Graph API - delete like
Here is what I have tried so far.
function delete_fb_event($event_data, $data)
{
//load the user for offline access and userid
$user = $this->load_user($data['aid']);
if(!empty($user[0]['fb_offline_access']))
{
//instantiate Facebook API
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'BLAHBLAHBLAH',
'secret' => 'BLAHBLAHBLAHBLAHBLAHBLAH',
'cookie' => true,
));
$fb_event = array(
"access_token" => $user[0]['fb_offline_access'],
);
$result = $facebook->api('/'.$event_data['fb_event_id'], 'DELETE', $fb_event); //Uncaught GraphMethodException: Unsupported delete request
//$result = $facebook->api('/'.$user[0]['fb_id']."_".$event_data['fb_event_id'], 'POST', array('access_token' => $user[0]['fb_offline_access'], 'method' => 'delete')); Uncaught OAuthException: (#803) Some of the aliases you requested do not exist
//$result = $facebook->api('/'.$event_data['fb_event_id']."_".$user[0]['fb_id'], 'POST', array('access_token' => $user[0]['fb_offline_access'], 'method' => 'delete')); Uncaught OAuthException: (#803) Some of the aliases you requested do not exist
//$result = $facebook->api('/'.$event_data['fb_event_id'], 'POST', array('access_token' => $user[0]['fb_offline_access'], 'method' => 'delete')); Uncaught GraphMethodException: Unsupported post request
//$result = $facebook->api('/'.$user[0]['fb_id']."_".$event_data['fb_event_id'], 'POST', array( 'access_token' => $user[0]['fb_offline_access'], 'method' => 'delete' )); Uncaught OAuthException: (#803) Some of the aliases you requested do not exist
return $result;
}
else
{
echo "error3"; //no FB offline access
}
}
Hey Peter, I tried running your code and I'm sorry to say I didn't have much success either.
My first guess was that you probably did not have the extended permissions - for deleting an event, you need to have to create_event permission
Although I tried with that, I keep getting the #200 Permission Error
On further digging I ran into a similar bug that was reported
http://bugs.developers.facebook.net/show_bug.cgi?id=12777
Interestingly - although this bug has been marked as resolved - if you read the comments, users are still reporting the same issue.
Sorry wasn't able to offer much help. Good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With