You are here

function _fb_user_get_fbu in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 5.2 fb_user.module \_fb_user_get_fbu()
  2. 5 fb_user.module \_fb_user_get_fbu()
  3. 6.3 fb_user.module \_fb_user_get_fbu()
  4. 6.2 fb_user.module \_fb_user_get_fbu()

Given a local user id, find the facebook id. This is for internal use. Outside modules use fb_get_fbu().

Only works if the "map accounts" feature is enabled, or the account was created by this module.

4 calls to _fb_user_get_fbu()
fb_user_fb in ./fb_user.module
Implements hook_fb.
fb_user_form_user_profile_form_alter in ./fb_user.module
Implements hook_form_user_profile_form_alter.
fb_user_token_values in ./fb_user.module
fb_user_user_load in ./fb_user.module
Implements hook_user_load.

File

./fb_user.module, line 1195
This module manages relations between local Drupal user accounts and their accounts on facebook.com.

Code

function _fb_user_get_fbu($uid) {
  $cache =& drupal_static(__FUNCTION__);

  // cache to avoid excess queries.
  if (!isset($cache[$uid])) {

    // Look up this user in the authmap
    $result = db_query("SELECT fbu FROM {fb_user} WHERE uid = :uid", array(
      ':uid' => $uid,
    ))
      ->fetchObject();
    if ($result) {
      $cache[$uid] = $result->fbu;
    }
    else {
      $cache[$uid] = NULL;
    }
  }
  return $cache[$uid];
}