You are here

function fb_graph_delete in Drupal for Facebook 7.4

Delete from facebook's graph.

File

./fb.module, line 1413

Code

function fb_graph_delete($path, $params) {
  if (isset($params['access_token']) && !$params['access_token'] && function_exists('debugger')) {
    debugger();
  }

  // Accept either params array or access token, for caller's convenience.
  if (is_array($params)) {
    $token = !empty($params['access_token']) ? $params['access_token'] : FALSE;
  }
  elseif (is_string($params)) {
    $token = $params;
    $params = array(
      'access_token' => $token,
    );
  }
  elseif ($params === NULL) {
    $token = NULL;
    $params = array(
      'access_token' => fb_access_token(),
    );
  }
  $url = url("https://graph.facebook.com/{$path}");
  $options = array(
    'method' => 'DELETE',
    'data' => drupal_http_build_query($params),
  );
  $data = fb_http($url, $options);
  return $data;
}