You are here

function fbconnect_autoconnect_form_validate in Facebook Connect 5

File

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

Code

function fbconnect_autoconnect_form_validate($form, &$form_state) {
  global $user;
  if ($user->uid) {
    return;
  }
  $fbuid = fbconnect_get_fbuid();
  if (!$fbuid) {
    return;
  }
  $uid = _is_fbconnect_user($fbuid);
  if (!$uid) {
    drupal_goto('fbconnect/register/prompt');
  }
  elseif ($uid) {
    $user = user_load($uid);
    db_query('UPDATE {users} SET login = %d WHERE uid = %d', time(), $user->uid);

    // If the fbconnect_profile module is enabled,
    // we checks the imported information's cache.
    if (module_exists('fbconnect_profile')) {
      fbconnect_profile_check_profile_cache($user->uid);
    }
    drupal_goto($_GET['q']);
  }
}