function profile2_regpath_save_settings in Profile2 Registration Path 7.2
Same name and namespace in other branches
- 7 profile2_regpath.admin.inc \profile2_regpath_save_settings()
Helper function to save profile settings.
1 string reference to 'profile2_regpath_save_settings'
- _profile2_regpath_form_profile2_type_form_alter in ./
profile2_regpath.admin.inc - Implements hook_form_FORM_ID_alter() for the registration form.
File
- ./
profile2_regpath.admin.inc, line 264 - Modifications to administrative forms.
Code
function profile2_regpath_save_settings($form, &$form_state) {
$profile_type = $form_state['values']['type'];
$profile_id = profile2_regpath_get_profile_id($profile_type);
// Define fields for db_merge.
$fields = array(
'path' => $form_state['values']['path'],
'status' => $form_state['values']['status'],
'weight' => $form_state['values']['weight'],
);
// Add roles if enabled.
$fields['roles'] = serialize($form_state['values']['roles']);
// Create array of miscellaneous display options.
$fields['misc'] = serialize(array(
'path_type' => $form_state['values']['path_type'],
'tab_text' => $form_state['values']['tab_text'],
'fieldset_wrap' => $form_state['values']['fieldset_wrap'],
'custom_titles' => $form_state['values']['custom_titles'],
'login_title' => $form_state['values']['login_title'],
'register_title' => $form_state['values']['register_title'],
'password_title' => $form_state['values']['password_title'],
'confirmation_display' => $form_state['values']['confirmation_display'],
'confirmation_message' => $form_state['values']['confirmation_message'],
));
// Add settings to database.
db_merge('profile2_regpath')
->key(array(
'profile_type' => $profile_type,
'profile_id' => $profile_id,
))
->fields($fields)
->execute();
// Rebuild the menu system to recognize any changed paths.
if (menu_rebuild()) {
drupal_set_message(t('The menu system has been rebuilt.'));
}
}