function fb_autopost_facebook_login in Facebook Autopost 7
Helper function to redirect after facebook login.
1 string reference to 'fb_autopost_facebook_login'
- fb_autopost_menu in ./
fb_autopost.module - Implements hook_menu().
File
- ./
fb_autopost.module, line 98 - Module implementation file
Code
function fb_autopost_facebook_login() {
// Show error messages from Facebook.
if (isset($_GET['error'])) {
drupal_set_message(t('An error happened while connecting with Facebook. Reason: %reason. Description: %description', array(
'%reason' => $_GET['error_reason'],
'%description' => $_GET['error_description'],
)), 'error');
}
else {
try {
$fb = facebook_autopost();
if ($fb_user = $fb
->getUser()) {
$token = $fb
->getAccessToken();
variable_set('fb_autopost_token', $token);
$user_profile = $fb
->api('/me?fields=id');
variable_set('fb_autopost_account_id', $user_profile['id']);
}
} catch (FacebookApiException $e) {
// Do nothing with the exception.
drupal_set_message($e
->getMessage(), 'error');
}
}
drupal_goto('admin/config/services/fbautopost');
}