function fbconnect_autoconnect_form_submit in Facebook Connect 6.2
Same name and namespace in other branches
- 6 fbconnect.module \fbconnect_autoconnect_form_submit()
@todo.
File
- ./
fbconnect.module, line 489 - Integration with Facebook Connect API.
Code
function fbconnect_autoconnect_form_submit($form, &$form_state) {
$fbuid = fbconnect_get_fbuid();
if (!$fbuid) {
$error_msg = 'fbconnect_autoconnect_form_submit has been called without valid facebook session. Check your Application Secret on fbconnect settings page';
watchdog('fbconnect', $error_msg, array(), WATCHDOG_ALERT, l(t('configure'), 'admin/settings/fbconnect'));
return;
}
if (user_is_anonymous()) {
if ($fbuid) {
$uid = _fbconnect_is_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) {
$account = user_load($uid);
user_external_login($account);
module_invoke('rules', 'invoke_event', 'fbconnect_user_login', $account);
}
}
}
else {
fbconnect_redirect_submit($form, $form_state);
}
}