contact_admin_edit_submit

Versions
4.7 – 5
contact_admin_edit_submit($form_id, $form_values)
6
contact_admin_edit_submit($form, &$form_state)

Process the contact category edit page form submission.

Code

modules/contact.module, line 216

<?php
function contact_admin_edit_submit($form_id, $form_values) {
  if ($form_values['selected']) {
    // Unselect all other contact categories.
    db_query('UPDATE {contact} SET selected = 0');
  }
  $recipients = explode(',', $form_values['recipients']);
  foreach($recipients as $key=>$recipient) {
    // E-mail address validation has already been done in _validate.
    $recipients[$key] = trim($recipient);
  }
  $form_values['recipients'] = implode(',', $recipients);
  if (arg(3) == 'add') {
    db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']);
    drupal_set_message(t('Category %category has been added.', array('%category' => theme('placeholder', $form_values['category']))));
    watchdog('mail', t('Contact form: category %category added.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));

  }
  else {
    db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']);
    drupal_set_message(t('Category %category has been updated.', array('%category' => theme('placeholder', $form_values['category']))));
    watchdog('mail', t('Contact form: category %category updated.', array('%category' => theme('placeholder', $form_values['category']))), WATCHDOG_NOTICE, l(t('view'), 'admin/contact'));
  }

  return 'admin/contact';
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.