You are here

function fb_api_check_session in Drupal for Facebook 6.2

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

Sometimes calls to fb_api_init succeed, but calls to the client api will fail because cookies are obsolete or what have you. This function makes a call to facebook to test the session. Expensive, so use only when necessary.

2 calls to fb_api_check_session()
fb_devel_info in ./fb_devel.module
fb_user_fb in ./fb_user.module
Implementation of hook_fb.

File

./fb.module, line 281

Code

function fb_api_check_session($fb) {

  // TODO: caching
  $success = FALSE;
  try {
    $is_user = $fb->api_client
      ->users_isAppUser();

    // Does not matter what is returned, as long as exception is not thrown.
    $success = TRUE;
  } catch (Exception $e) {
    $success = FALSE;
  }
  return $success;
}