You are here

function profile_field_form_submit in Drupal 5

Same name and namespace in other branches
  1. 4 modules/profile.module \profile_field_form_submit()
  2. 6 modules/profile/profile.admin.inc \profile_field_form_submit()
  3. 7 modules/profile/profile.admin.inc \profile_field_form_submit()

Process profile_field_form submissions.

File

modules/profile/profile.module, line 351
Support for configurable user profiles.

Code

function profile_field_form_submit($form_id, $form_values) {
  if (!isset($form_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_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['type'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['autocomplete'], $form_values['options'], $form_values['page']);
    drupal_set_message(t('The field has been created.'));
    watchdog('profile', t('Profile field %field added under category %category.', array(
      '%field' => $form_values['title'],
      '%category' => $form_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_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['autocomplete'], $form_values['options'], $form_values['page'], $form_values['fid']);
    drupal_set_message(t('The field has been updated.'));
  }
  cache_clear_all();
  return 'admin/user/profile';
}