function fbconnect_autoconnect_form_submit in Facebook Connect 6
Same name and namespace in other branches
- 6.2 fbconnect.module \fbconnect_autoconnect_form_submit()
File
- ./
fbconnect.module, line 644
Code
function fbconnect_autoconnect_form_submit($form, &$form_state) {
if (user_is_anonymous()) {
$fbuid = fbconnect_get_fbuid();
if ($fbuid) {
$uid = _is_fbconnect_user($fbuid);
$form_state['values']['uid'] = $uid;
$form_state['values']['fbuid'] = $fbuid;
if (!$uid) {
if (variable_get('fbconnect_reg_options', 0) == 1) {
$form_state['redirect'] = array(
'fbconnect/register/create',
drupal_get_destination(),
);
}
else {
$form_state['redirect'] = array(
'fbconnect/register/prompt',
drupal_get_destination(),
);
}
#805846 : No linking with FB page appears, when "destination" variable exist in url
unset($_REQUEST['destination']);
}
elseif ($uid) {
$user = user_load($uid);
user_external_login($user);
$form_state['redirect'] = $_GET['q'] == 'user/login' || $_GET['q'] == 'user/register' || $_GET['q'] == 'user/password' ? 'user' : $_GET['q'];
}
}
}
else {
fbconnect_redirect_submit($form, $form_state);
}
}