You are here

function fbconnect_register in Facebook Connect 6

Same name and namespace in other branches
  1. 5 fbconnect.module \fbconnect_register()
  2. 6.2 fbconnect.module \fbconnect_register()

Store user into table fbconnect

Parameters

Int $uid: Drupal user id

Int $fbuid: Facebook user id

2 calls to fbconnect_register()
fbconnect_redirect_submit in ./fbconnect.module
Redirects the user to the account linking page.
fbconnect_register_form_submit in ./fbconnect.pages.inc

File

./fbconnect.module, line 748

Code

function fbconnect_register($uid, $fbuid) {
  if (_get_user_fbuid($uid)) {
    return FALSE;
  }
  if (_is_fbconnect_user($fbuid)) {
    return FALSE;
  }
  $delete_query = 'DELETE FROM {fbconnect_users} WHERE uid = %d';
  $insert_query = 'INSERT INTO {fbconnect_users} (uid, fbuid, timestamp) VALUES (%d, \'%s\', %d)';
  db_query($delete_query, $uid);
  if (db_query($insert_query, $uid, $fbuid, time())) {
    user_save(user_load($uid), array(
      'fbuid' => $fbuid,
    ));
    return TRUE;
  }
  return FALSE;
}