You are here

public function FBAutopost::hasActiveAccessToken in Facebook Autopost 7

Checks if a user has an active access token.

Return value

boolean TRUE if the user may publish to the timeline.

File

class/FBAutopost.php, line 463

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 hasActiveAccessToken() {
  $access_token = FALSE;
  foreach ($_SESSION as $key => $value) {
    if (preg_match("/fb_\\d+_access_token/", $key)) {
      $access_token = $value;
      break;
    }
  }

  // This is to make sure the access token is not gotten from the app.
  return $this
    ->getAccessToken() == $access_token;
}