You are here

function _fb_user_set_map in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 7.4 fb_user.module \_fb_user_set_map()
  2. 7.3 fb_user.module \_fb_user_set_map()

Helper function to add or update a row in the fb_user table, which maps local uid to facebook ids.

4 calls to _fb_user_set_map()
fb_user_create_local_user in ./fb_user.module
Creates a local Drupal account for the specified facebook user id.
fb_user_user in ./fb_user.module
Implementation of hook_user().
_fb_user_create_map in ./fb_user.module
Create a map linking the facebook account to the currently logged in local user account.
_fb_user_create_map_by_email in ./fb_user.module

File

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

Code

function _fb_user_set_map($account, $fbu) {
  if ($fbu && $account->uid != 0) {

    // Delete any pre-existing mapping that might exist for this local uid or fbu.
    db_query("DELETE FROM {fb_user} WHERE uid=%d OR fbu=%d", $account->uid, $fbu);

    // Create the new mapping.
    db_query("INSERT INTO {fb_user} (uid, fbu) VALUES (%d, %d)", $account->uid, $fbu);
    if (fb_verbose()) {
      watchdog('fb_user', 'Using fb_user to associate user !user with facebook user id %fbu.', array(
        '!user' => l($account->name, 'user/' . $account->uid),
        '%fbu' => $fbu,
      ));
    }
  }
}