You are here

function _fb_user_get_fbu in Drupal for Facebook 6.2

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. 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.

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 824
This module manages relations between local Drupal user accounts and their accounts on facebook.com.

Code

function _fb_user_get_fbu($uid, $fb_app) {
  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 authname FROM {authmap} WHERE uid=%d AND module='%s'", array(
      $uid,
      'fb_user',
    )));
    if ($result) {
      $cache[$uid] = $result;
    }
  }
  if (isset($cache[$uid])) {
    return $cache[$uid];
  }
}