function _fb_user_sync_redirect in Drupal for Facebook 5
2 calls to _fb_user_sync_redirect()
- fb_user_post_add_check in ./
fb_user.module - This method will redirect a user if the post-add page need not be displayed.
- fb_user_sync_cb in ./
fb_user.module - The sync callback is invoked first on a canvas page, in which case we require the user to add the application. Later the user will be redirected to this callback on the locale server, with an token that allows us to write the necessary row to the…
File
- ./
fb_user.module, line 228 - This module allows Drupal user records to be associated with Facebook user ids. It can create local user accounts when Facebook users visit an application's canvas pages.
Code
function _fb_user_sync_redirect($redirect) {
global $user;
global $fb, $fb_app;
$cache_data = array(
'request' => $_REQUEST,
'fbu' => fb_facebook_user(),
'fb_app' => $fb_app,
);
// Generate a one-time key for cached data. We used to use Facebook's
// auth_token here, but it's not always available
// so better to generate our own.
$key = uniqid('fb_user_');
cache_set($key, 'cache', serialize($cache_data), CACHE_TEMPORARY);
// Note that drupal_goto will fail here, but $fb->redirect succeeds.
$url = fb_scrub_urls(url($redirect, 'sync_token=' . $key, NULL, TRUE));
if (fb_verbose()) {
watchdog('fb_debug', "Redirecting to {$url}");
}
$fb
->redirect($url);
exit;
}