You are here

function fbconnect_login_register in Facebook Connect 8.2

Same name and namespace in other branches
  1. 7.2 fbconnect_login/fbconnect_login.module \fbconnect_login_register()

Stores user into table fbconnect.

6 calls to fbconnect_login_register()
FbconnectTestCase::testLogin in tests/fbconnect.test
fbconnect_login_add_user_afterlogin_submit in fbconnect_login/fbconnect_login.module
Add the user to the fbconnect_users table if they logged in with Facebook
fbconnect_login_autoconnect_form_submit in fbconnect_login/fbconnect_login.module
Submit handler for autoconnect form.
fbconnect_login_redirect_submit in fbconnect_login/fbconnect_login.module
Redirects the user to the account linking page. @todo refactor it
fbconnect_login_register_form_submit in fbconnect_login/fbconnect_login.pages.inc
_state

... See full list

File

fbconnect_login/fbconnect_login.module, line 439
Login functionality for Facebook Connect module

Code

function fbconnect_login_register($uid, $fbuid) {
  if (_get_user_fbuid($uid) || _is_fbconnect_user($fbuid)) {
    return FALSE;
  }
  db_merge('fbconnect_users')
    ->key(array(
    'uid' => $uid,
  ))
    ->fields(array(
    'fbuid' => $fbuid,
    'timestamp' => REQUEST_TIME,
  ))
    ->execute();
  $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;
}