You are here

function _fb_user_get_fbu in Drupal for Facebook 6.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.2 fb_user.module \_fb_user_get_fbu()
  4. 7.3 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.

3 calls to _fb_user_get_fbu()
fb_user_fb in ./fb_user.module
Implementation of hook_fb.
fb_user_token_values in ./fb_user.module
fb_user_user in ./fb_user.module
Implementation of hook_user().

File

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

Code

function _fb_user_get_fbu($uid) {
  static $cache = array();

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

    // Look up this user in the authmap
    $result = db_result(db_query("SELECT fbu FROM {fb_user} WHERE uid=%d", array(
      $uid,
    )));
    $cache[$uid] = $result;
  }
  if (isset($cache[$uid])) {
    return $cache[$uid];
  }
}