function fb_autopost_authorization_retry in Facebook Autopost 7
Helper function to publish on user timeline after failing the first time.
1 string reference to 'fb_autopost_authorization_retry'
- fb_autopost_menu in ./
fb_autopost.module - Implements hook_menu().
File
- ./
fb_autopost.module, line 144 - Module implementation file
Code
function fb_autopost_authorization_retry() {
try {
$session = new FBSession();
// Check if there is all necessary data.
if ($session
->isStored()) {
$data = $session
->getStoredPublication();
$fb = facebook_autopost($data['publication']['type']);
// Prevent infinite loop of requesting permissions.
$fb
->setRetry(FALSE);
$fb
->setDestination($data['target']);
$fb
->publish($data['publication']);
}
} catch (Exception $e) {
// Not removing session would lead to be unable to publish until
// session gets regenerated.
$session = new FBSession();
$session
->removePublication();
watchdog_exception('fb_autopost', $e);
drupal_set_message($e
->getMessage(), 'error');
}
// This method does not throw anything.
$destination = isset($data['destination']) ? $data['destination'] : '<front>';
$session
->removePublication();
drupal_goto($destination);
}