function fboauth_save in Facebook OAuth (FBOAuth) 6
Same name and namespace in other branches
- 7.2 fboauth.module \fboauth_save()
- 7 fboauth.module \fboauth_save()
Save a Drupal User ID to Facebook ID pairing.
Passing in NULL for $fbid can also be used to delete a UID to FBID pairing.
6 calls to fboauth_save()
- fboauth_action_connect in includes/
fboauth.fboauth.inc - Facebook OAuth callback for initiating a Facebook connection.
- fboauth_action_deauth in includes/
fboauth.fboauth.inc - Facebook OAuth callback for deauthorizing the site from Facebook.
- fboauth_deauthorize in includes/
fboauth.fboauth.inc - Process a deauthorization request from Facebook.
- fboauth_user_delete in ./
fboauth.module - Implements hook_user_delete().
- fboauth_user_insert in ./
fboauth.module - Implements hook_user_insert().
File
- ./
fboauth.module, line 270
Code
function fboauth_save($uid, $fbid) {
// Delete the existing Facebook ID if present for this Drupal user.
$delete_query = 'DELETE FROM {fboauth_users} WHERE uid = %d';
$delete_arguments = array(
$uid,
);
// If setting a new Facebook ID for an account, also make sure no other
// Drupal account is connected with this Facebook ID.
if (isset($fbid)) {
$delete_query .= ' OR fbid = %d';
$delete_arguments[] = $fbid;
}
db_query($delete_query, $delete_arguments);
if (!empty($fbid)) {
db_query('INSERT INTO {fboauth_users} (uid, fbid) VALUES (%d, %d)', $uid, $fbid);
}
}