You are here

public function FBAutopost::setPrivacy in Facebook Autopost 7

Sets the privacy.

Parameters

string $privacy_code: Privacy string as defined in Facebook documentation. Allowed values are:

  • EVERYONE
  • ALL_FRIENDS
  • FRIENDS_OF_FRIENDS
  • SELF

Return value

$this Returns itself.

Throws

FBAutopostException

See also

https://developers.facebook.com/docs/reference/api/privacy-parameter

File

class/FBAutopost.php, line 393

Class

FBAutopost
API class to handle common actions when autoposting This class uses FBAutopostException for error handling. Severity is passed resusing watchdog severity (See: http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/watch...)

Code

public function setPrivacy($privacy_code) {
  if (!in_array($privacy_code, array(
    'ALL_FRIENDS',
    'EVERYONE',
    'SELF',
    'FRIENDS_OF_FRIENDS',
  ))) {
    throw new FBAutopostException(t('The privacy code you specified is invalid.'), FBAutopost::incorrect_param, WATCHDOG_ERROR);
  }
  $this->privacy = $privacy_code;
  return $this;
}