function fbconnect_register_form_submit in Facebook Connect 5
Same name and namespace in other branches
- 6.2 fbconnect.pages.inc \fbconnect_register_form_submit()
- 6 fbconnect.pages.inc \fbconnect_register_form_submit()
Handle post-validation register form submission.
File
- ./
fbconnect.module, line 322 - This module allows site visitors to connect and register with facebook account
Code
function fbconnect_register_form_submit($form, &$form_state) {
global $user;
$visible = $form_state['visibility'];
$mail = $form_state['mail'];
$udata = array(
'name' => $form_state['username'],
'mail' => $mail,
'init' => $mail,
'status' => 1,
'login' => time(),
'pass' => user_password(),
);
fbconnect_register_user($udata);
// Update user visibility, default = 1
if (!$visible) {
fbconnect_set_user_visibility($user, $visible);
}
if ($_SESSION['fb_reg_import'] && module_exists('fbconnect_profile')) {
// Saving import settings.
fbconnect_profile_insert_user_info($user->uid, $_SESSION['fb_reg_import']);
unset($_SESSION['fb_reg_import']);
}
// If the user chose to be visible, and the registration feed parameter is enabled.
// We store a value in the session variable,
// this variable will be read by the _fbconnect_render_js function.
if (variable_get('fbconnect_reg_feed', 1) && $visible) {
$_SESSION['fbconnect_feed']['type'] = 'registration';
}
// The user has chosen to be visible, just redirect to the friends invite page.
if ($visible) {
$sitename = variable_get('site_name', t('this website'));
$welcome_msg = t('Registration successful. You may now invite friends to join you on @site', array(
'@site' => $sitename,
));
drupal_set_message($welcome_msg, 'status');
drupal_goto('fbconnect/invite/friends');
}
else {
drupal_set_message(t('Registration successful.'));
drupal_goto();
}
}