You are here

function fb_facebook_user in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 5.2 fb.module \fb_facebook_user()
  2. 5 fb.module \fb_facebook_user()
  3. 6.2 fb.module \fb_facebook_user()
  4. 7.4 fb_devel.module \fb_facebook_user()
  5. 7.3 fb.module \fb_facebook_user()

Returns the facebook user id currently visiting a canvas page, or if set_user has been called. Unlike fb_get_fbu(), works only on canvas and connect pages, or when infinite session has been initialized.

38 calls to fb_facebook_user()
fb_access_denied in ./fb.module
Convenience wrapper around drupal_access_denied(). Call on pages where the access is denied because the user is not logged into facebook.
fb_api_init in ./fb.module
Include and initialize Facebook's PHP SDK.
fb_app_user in ./fb_app.module
Implementation of hook_user.
fb_canvas_fb in ./fb_canvas.module
Implementation of hook_fb().
fb_devel_fb in ./fb_devel.module
Implements hook_fb().

... See full list

File

./fb.module, line 914
This is the core required module of Drupal for Facebook.

Code

function fb_facebook_user($fb = NULL) {
  if (!isset($fb)) {
    $fb = $GLOBALS['_fb'];
  }
  if (!$fb) {
    return;
  }
  try {
    $fbu = $fb
      ->getUser();
    return $fbu;
  } catch (FacebookApiException $e) {
    fb_log_exception($e, t('Failed to get Facebook user id.  detail: !detail', array(
      '!detail' => print_r($e, 1),
    )));
  }
}