function fbconnect_register in Facebook Connect 6.2
Same name and namespace in other branches
- 5 fbconnect.module \fbconnect_register()
- 6 fbconnect.module \fbconnect_register()
Store user into table fbconnect
Parameters
Int $uid: Drupal user id
Int $fbuid: Facebook user id
3 calls to fbconnect_register()
- FbconnectTestCase::testLogin in tests/
fbconnect.test - @todo.
- fbconnect_redirect_submit in ./
fbconnect.module - Redirects the user to the account linking page. @todo refactor it
- fbconnect_register_form_submit in ./
fbconnect.pages.inc - @todo.
File
- ./
fbconnect.module, line 573 - Integration with Facebook Connect API.
Code
function fbconnect_register($uid, $fbuid) {
if (_fbconnect_get_user_fbuid($uid)) {
return FALSE;
}
if (_fbconnect_is_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())) {
$account = user_load($uid);
$account->fbuid = $fbuid;
user_save($account, array(
'fbuid' => $fbuid,
));
module_invoke('rules', 'invoke_event', 'fbconnect_user_registered', $account);
watchdog('fbconnect', 'User has connected his Facebook account (@fbuid)', array(
'@fbuid' => $fbuid,
), WATCHDOG_NOTICE, l(t('edit'), "user/{$uid}/edit/fbconnect"));
return TRUE;
}
return FALSE;
}