You are here

function fb_facebook_user in Drupal for Facebook 7.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.3 fb.module \fb_facebook_user()
  4. 6.2 fb.module \fb_facebook_user()
  5. 7.4 fb_devel.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.

43 calls to fb_facebook_user()
fbu_load in ./fb.module
Implementation of a %wildcard_load(). http://drupal.org/node/224170
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
Implements hook_user.
fb_canvas_fb in ./fb_canvas.module
Implements hook_fb().

... See full list

1 string reference to 'fb_facebook_user'
fb_rules_rules_condition_info in contrib/fb_rules.rules.inc
Implementation of hook_rules_condition_info().

File

./fb.module, line 1015
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),
    )));
  }
}