function simple_fb_connect_redirect_to_fb in Simple FB Connect 7.2
Page callback for /user/simple-fb-connect.
Redirects the user to FB for authentication.
1 string reference to 'simple_fb_connect_redirect_to_fb'
- simple_fb_connect_menu in ./
simple_fb_connect.module - Implements hook_menu().
File
- ./
simple_fb_connect.module, line 126 - Simple Facebook Login Module for Drupal Sites.
Code
function simple_fb_connect_redirect_to_fb() {
// Validate configuration.
if (!simple_fb_connect_initialize()) {
drupal_goto('user');
}
// FacebookRedirectLoginHelper requires session to be started.
drupal_session_start();
// Generate the URL where FB will return the user after authentication.
$return_url = simple_fb_connect_get_return_url();
$login_helper = new FacebookRedirectLoginHelper($return_url);
// Allow other modules to modify FB permission scope.
$scope = simple_fb_connect_get_scope();
// Save the post login URL to session variables.
simple_fb_connect_save_post_login_url();
// Generate the URL where the user will be redirected for FB login.
// If the user did not have email permission granted on previous attempt,
// we use the re-request URL requesting only the email address.
$api_version = simple_fb_connect_get_api_version();
$login_url = $login_helper
->getLoginUrl($scope, $api_version);
if (isset($_SESSION['simple_fb_connect']['reprompt'])) {
$scope = array(
'public_profile',
'email',
);
$login_url = $login_helper
->getReRequestUrl($scope, $api_version);
}
// Redirect the user to Facebook for login.
drupal_goto($login_url);
// We should never reach this point because the user was redirected.
return MENU_ACCESS_DENIED;
}