function fbconnect_register_page in Facebook Connect 6
Same name and namespace in other branches
- 5 fbconnect.module \fbconnect_register_page()
- 6.2 fbconnect.pages.inc \fbconnect_register_page()
Menu callback. Called when user perform facebook registration
1 string reference to 'fbconnect_register_page'
- fbconnect_menu in ./
fbconnect.module - Implementation of hook_menu().
File
- ./
fbconnect.pages.inc, line 49
Code
function fbconnect_register_page($form_state = array()) {
$conf = fbconnect_get_config();
$fbuid = fbconnect_get_fbuid();
$data = fbconnect_get_info_from_fb($fbuid, 'name, proxied_email');
$form = drupal_retrieve_form('user_register', $form_state);
$site = $conf['invite_name'];
drupal_prepare_form('user_register', $form, $form_state);
$form['name']['#default_value'] = $data['name'];
$form['fbconnect'] = array(
'#type' => 'fieldset',
'#title' => t('Facebook Connect'),
);
$form['fbconnect']['fb_visible'] = array(
'#type' => 'checkbox',
'#title' => t('Let my Facebook friends see me on @sitename', array(
'@sitename' => $site,
)),
'#default_value' => 1,
);
if (variable_get('user_pictures', 0) && $conf['user_pictures'] == 'allow') {
$form['fbconnect']['fb_avatar'] = array(
'#type' => 'checkbox',
'#title' => t('Use my Facebook picture as user picture'),
'#description' => t('Your picture will be loaded from facebook.'),
'#default_value' => 1,
);
}
$form['#redirect'] = isset($_REQUEST['destination']) ? $_REQUEST['destination'] : '';
$form['#submit'][] = 'fbconnect_register_form_submit';
// Fast registration mode, we by pass std drupal reg form.
if ($conf['fast_reg_mode']) {
$form_state['values']['name'] = $data['name'];
$form_state['values']['mail'] = $data['proxied_email'];
$form_state['values']['pass'] = user_password();
$form_state['values']['status'] = 1;
$form_state['values']['fb_visible'] = 1;
$form_state['values']['fb_avatar'] = 1;
drupal_validate_form('user_register', $form, $form_state);
if (form_get_errors()) {
$dest = array(
'query' => 'destination=fbconnect',
);
drupal_set_message(t('Facebook connect registration failed for the reasons listed. You may register now, or if you already have an account you can <a href="@login">log in</a> now and link your account', array(
'@login' => url('user/login', $dest),
)), 'error');
drupal_goto('user/register');
}
fbconnect_register_form_submit($form, $form_state);
drupal_goto();
}
return $form;
}