Jump to content

facebook graph api & php sdk, deleting events!


petroz

Recommended Posts

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/

http://stackoverflow.com/questions/2931387/facebook-sdk-and-graph-api-comment-deleting-error

http://stackoverflow.com/questions/2858748/facebook-api-delete-status

http://stackoverflow.com/questions/3832405/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
    }       
}   

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.