Facebook `comments.remove` API Method

With FB's Comment Social plugin, having to remove comments on a certain Application is a click away as long as the current user has the Admin rights. This thing right here may be necessary to those who wanted a custom Administration sort of utility for managing FB App related comments.

Here's a sample code of how one could implement this method:

public function removeComment($commentId, $xid)
{
  try {
    // This prevents FB from throwing: `SSL certificate problem, verify that the CA cert is OK.`
    // Not required if you have your SSL certificate
    Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
    Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;

    $client = $this->getClient(); // Create an instance of our PHP SDK
    return $client->api(array(
      'method' => 'comments.remove',
      'comment_id' => $commentId,
      'xid' => $xid,
    ));

  } catch (FacebookApiException $e) {
    Yii::log($e->__toString(), CLogger::LEVEL_ERROR, __CLASS__);
  }
  return false;
}

Bookmark and Share

0 comments :

Post a Comment

Hi there! Please leave your message here. Also, I may not be able to respond to your query right away. So please bear with me. Thanks. :)