You are here

function fbconnect_register_user in Facebook Connect 5

2 calls to fbconnect_register_user()
fbconnect_register_form_submit in ./fbconnect.module
Handle post-validation register form submission.
fbconnect_register_page in ./fbconnect.module
Menu callback. Called when user perform facebook registration

File

./fbconnect.module, line 296
This module allows site visitors to connect and register with facebook account

Code

function fbconnect_register_user($data) {
  global $user;
  $data['roles'][DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
  $fbuid = fbconnect_get_fbuid();

  // Save facebook picture as avatar.
  if (variable_get('user_pictures', 0)) {
    $picture = fbconnect_get_fb_avatar($fbuid);
    if ($picture) {
      $data['picture'] = $picture;
    }
  }
  $user = user_save($user, $data);
  if ($user->uid) {
    $msg = t('New user: %name %email.', array(
      '%name' => $data['name'],
      '%email' => '<' . $data['mail'] . '>',
    ));
    watchdog('fbconnect', $msg, WATCHDOG_NOTICE, l(t('edit'), 'user/' . $user->uid . '/edit'));
  }
  fbconnect_register($user->uid, $fbuid);
}