You are here

function _fb_api_init in Drupal for Facebook 5

Same name and namespace in other branches
  1. 5.2 fb.module \_fb_api_init()
  2. 6.3 fb.module \_fb_api_init()
  3. 6.2 fb.module \_fb_api_init()
  4. 7.3 fb.module \_fb_api_init()

Wrapper function for fb_api_init. This helps for functions that should work whether or not we are on a canvas page. For canvas pages, the active fb object is used. For non-canvas pages, it will initialize the API using an infinite session, if configured.

Parameters

$fb_app Note this is ignored on canvas pages.:

This is for internal use. Third party modules use fb_api_init().

1 call to _fb_api_init()
fb_get_groups_data in ./fb.module

File

./fb.module, line 239

Code

function _fb_api_init($fb_app = NULL) {
  $fb = $GLOBALS['fb'];

  // Default to active app on canvas pages
  if (!$fb && $fb_app) {

    // Otherwise, log into facebook api.
    $fb = fb_api_init($fb_app, FB_FBU_ANY);
  }
  if (!$fb) {
    watchdog('fb', t('%function unable to initialize Facebook API.', array(
      '%function' => '_fb_api_init()',
    )), WATCHDOG_ERROR);
    return;
  }
  else {
    return $fb;
  }
}