function _bakery_register_submit in Bakery Single Sign-On System 6.2
Same name and namespace in other branches
- 8.2 bakery.module \_bakery_register_submit()
- 7.2 bakery.module \_bakery_register_submit()
- 7.3 bakery.module \_bakery_register_submit()
Handle registration by redirecting to master.
1 string reference to '_bakery_register_submit'
- bakery_form_alter in ./
bakery.module - Implementation of hook_form_alter().
File
- ./
bakery.module, line 427
Code
function _bakery_register_submit($form, &$form_state) {
// Create an array of fields to send to the master. We need these four fields.
$allowed = array(
'name',
'mail',
'pass',
'timezone',
);
if (module_exists('profile')) {
// Now figure out profile field names that are visible on the registration form.
$field_names = db_query("SELECT name FROM {profile_fields} WHERE register = 1");
while ($field_name = db_fetch_object($field_names)) {
$allowed[] = $field_name->name;
}
}
foreach ($form_state['values'] as $key => $value) {
if (!in_array($key, $allowed)) {
unset($form_state['values'][$key]);
}
}
// Save values to cookie.
$data = $form_state['values'];
_bakery_save_destination_param($form, $data);
unset($_REQUEST['destination']);
// Store name and email in case of error and return from master.
$_SESSION['bakery']['register'] = array(
'name' => $data['name'],
'mail' => $data['mail'],
);
// Create cookie and redirect to master.
bakery_bake_oatmeal_cookie($data['name'], $data);
drupal_goto(variable_get('bakery_master', 'http://drupal.org/') . 'bakery');
}