You are here

function fb_autopost_facebook_logout in Facebook Autopost 7

Helper function to redirect after facebook logout.

1 string reference to 'fb_autopost_facebook_logout'
fb_autopost_menu in ./fb_autopost.module
Implements hook_menu().

File

./fb_autopost.module, line 124
Module implementation file

Code

function fb_autopost_facebook_logout() {
  try {
    $fb = facebook_autopost();

    // Invalidate access_token
    $fb
      ->api('/' . variable_get('fb_autopost_account_id', 'me') . '/permissions', 'DELETE');
  } catch (FacebookApiException $e) {

    // Do nothing with the exception.
    drupal_set_message($e
      ->getMessage(), 'error');
  }
  drupal_set_message(t('Your account has been logged out from Facebook and the permissions for the app have been removed.'));

  // Delete stored variables.
  variable_del('fb_autopost_account_id');
  variable_del('fb_autopost_page');
  drupal_goto('admin/config/services/fbautopost');
}