function fb_connect_app_init in Drupal for Facebook 6.2
Same name and namespace in other branches
- 5.2 fb_connect.module \fb_connect_app_init()
- 6.3 fb_connect.module \fb_connect_app_init()
- 7.3 fb_connect.module \fb_connect_app_init()
Prepare for fbConnect use. Because a single Drupal might support multiple apps, we don't know in advance which is the fbConnect app. Theoretically, it might be possible to simultaneously use multiple apps and fbConnect, but my suspicion is facebook would throw a total hissy-fit if you tried.
2 calls to fb_connect_app_init()
- fb_connect_block in ./
fb_connect.module - Implementation of hook_block.
- fb_connect_form_alter in ./
fb_connect.module
File
- ./
fb_connect.module, line 171 - Support for Facebook Connect features
Code
function fb_connect_app_init($fb_app) {
if (isset($GLOBALS['_fb_app']) && fb_is_iframe_canvas() && $GLOBALS['_fb_app']->apikey != $fb_app->apikey) {
// If we're in an iframe, only support connect for the iframe app.
return;
}
if ($fb = fb_api_init($fb_app, FB_FBU_CURRENT)) {
$fbu = $fb
->get_loggedin_user();
// TODO: sometimes this method indicates we are logged in when we really are not. Find a way to verify.
if ($fbu && (!isset($GLOBALS['_fb_app']) || $GLOBALS['_fb_app']->apikey != $fb_app->apikey)) {
// The user has authorized the app and we now know something about them. Use a hook to trigger the actions of other modules.
fb_invoke(FB_OP_APP_IS_AUTHORIZED, array(
'fbu' => $fbu,
'fb_app' => $fb_app,
'fb' => $fb,
));
}
// Remember which app we've initialized.
_fb_connect_set_app($fb_app);
}
return $fb;
}