You are here

function fb_connect_fb in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 6.3 fb_connect.module \fb_connect_fb()
  2. 6.2 fb_connect.module \fb_connect_fb()
  3. 7.3 fb_connect.module \fb_connect_fb()

Implementation of hook_fb().

File

./fb_connect.module, line 74
Support for Facebook Connect features

Code

function fb_connect_fb($op, $data, &$return) {

  //dpm(func_get_args(), "fb_connect_fb($op)");
  if ($op == FB_OP_CURRENT_APP && !$return) {

    // This will cause fb.module to set the global $fb when user is logged in via fbConnect.
    if ($apikey = variable_get('fb_connect_primary_apikey', NULL)) {
      $return = fb_get_app(array(
        'apikey' => $apikey,
      ));
    }
  }
  else {
    if ($op == FB_OP_POST_INIT) {
      if ($apikey = variable_get('fb_connect_primary_apikey', NULL)) {
        if ($data['fb_app']->apikey == $apikey) {

          // Init Facebook javascript whenever logged into fbConnect
          fb_connect_require_feature('XFBML', $fb_app);

          // fb_connect_init_option('reloadIfSessionStateChanged', TRUE, $fb_app);
          fb_connect_init_option('ifUserConnected', "{fb_connect_on_connected}", $fb_app);
          fb_connect_init_option('ifUserNotConnected', "{fb_connect_on_not_connected}", $fb_app);
        }
      }
    }
  }
}