function profile_field_form_submit in Drupal 6
Same name and namespace in other branches
- 4 modules/profile.module \profile_field_form_submit()
- 5 modules/profile/profile.module \profile_field_form_submit()
- 7 modules/profile/profile.admin.inc \profile_field_form_submit()
Process profile_field_form submissions.
File
- modules/
profile/ profile.admin.inc, line 334 - Administrative page callbacks for the profile module.
Code
function profile_field_form_submit($form, &$form_state) {
if (!isset($form_state['values']['options'])) {
$form_state['values']['options'] = '';
}
if (!isset($form_state['values']['page'])) {
$form_state['values']['page'] = '';
}
if (!isset($form_state['values']['fid'])) {
db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s', '%s')", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['type'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page']);
drupal_set_message(t('The field has been created.'));
watchdog('profile', 'Profile field %field added under category %category.', array(
'%field' => $form_state['values']['title'],
'%category' => $form_state['values']['category'],
), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile'));
}
else {
db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, autocomplete = %d, options = '%s', page = '%s' WHERE fid = %d", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page'], $form_state['values']['fid']);
drupal_set_message(t('The field has been updated.'));
}
cache_clear_all();
menu_rebuild();
$form_state['redirect'] = 'admin/user/profile';
return;
}