You are here

private static function FBAutopost::getPagesAccessTokens in Facebook Autopost 7

Get access tokens for publishing to several Facebook Pages

Parameters

$account_id: User account asked for

$account_access_token: Server side access token stored from the admin form.

Return value

A keyed array indexed by page id and containing the values:

  • 'id': Facebook page id
  • 'access_token': Access token for publishing to the page

Throws

FBAutopostException

2 calls to FBAutopost::getPagesAccessTokens()
FBAutopost::checkPagesAvailability in class/FBAutopost.php
Throws an exception if the selected page id is not among the authorized ones.
FBAutopost::publishParameterPrepare in class/FBAutopost.php
Prepares the parameters to publish to Facebook, this means settings any field or destination dependent configuration.

File

class/FBAutopost.php, line 276

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

private static function getPagesAccessTokens($account_id, $account_access_token) {
  $pages = array();
  foreach (variable_get('fb_autopost_pages_access_tokens', array()) as $page_id => $page_access_token) {
    $pages[$page_id] = array(
      'id' => $page_id,
      'access_token' => $page_access_token,
    );
  }
  return $pages;
}