Same name and namespace in other branches
  1. 4.7.x modules/contact.module \contact_admin_edit_submit()
  2. 5.x modules/contact/contact.module \contact_admin_edit_submit()

Process the contact category edit page form submission.

File

modules/contact/contact.admin.inc, line 100
Admin page callbacks for the contact module.

Code

function contact_admin_edit_submit($form, &$form_state) {
  if ($form_state['values']['selected']) {

    // Unselect all other contact categories.
    db_query('UPDATE {contact} SET selected = 0');
  }
  $recipients = explode(',', $form_state['values']['recipients']);
  foreach ($recipients as $key => $recipient) {

    // E-mail address validation has already been done in _validate.
    $recipients[$key] = trim($recipient);
  }
  $form_state['values']['recipients'] = implode(',', $recipients);
  if (empty($form_state['values']['cid']) || $form_state['values']['contact_op'] == 'add') {
    drupal_write_record('contact', $form_state['values']);
    drupal_set_message(t('Category %category has been added.', array(
      '%category' => $form_state['values']['category'],
    )));
    watchdog('mail', 'Contact form: category %category added.', array(
      '%category' => $form_state['values']['category'],
    ), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact'));
  }
  else {
    drupal_write_record('contact', $form_state['values'], 'cid');
    drupal_set_message(t('Category %category has been updated.', array(
      '%category' => $form_state['values']['category'],
    )));
    watchdog('mail', 'Contact form: category %category updated.', array(
      '%category' => $form_state['values']['category'],
    ), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact'));
  }
  $form_state['redirect'] = 'admin/build/contact';
  return;
}