You are here

function signup_settings_form_submit in Signup 7

Same name and namespace in other branches
  1. 6.2 includes/admin.settings.inc \signup_settings_form_submit()
  2. 6 includes/admin.settings.inc \signup_settings_form_submit()

Submits the signup settings form

Parameters

string $form_id: The ID of the form being submitted.

array $form_values: The constructed form values array of the submitted form.

1 string reference to 'signup_settings_form_submit'
signup_settings_form in includes/admin.settings.inc
Form builder for the settings page under admin/config/people/signup

File

includes/admin.settings.inc, line 196
Code required for the signup settings page (admin/config/people/signup).

Code

function signup_settings_form_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  if ($op == t('Save configuration') && (bool) db_query_range('SELECT 1 FROM {signup} WHERE nid = :nid', 0, 1, array(
    ':nid' => 0,
  ))
    ->fetchField()) {

    // TODO Please review the conversion of this statement to the D7 database API syntax.
    db_update('signup')
      ->fields(array(
      'forwarding_email' => $form_state['values']['signup_forwarding_email'],
      'send_confirmation' => $form_state['values']['signup_send_confirmation'],
      'confirmation_email' => $form_state['values']['signup_confirmation_email'],
      'close_signup_limit' => $form_state['values']['signup_close_signup_limit'],
      'reminder_days_before' => isset($form_state['values']['signup_reminder_days_before']) ? $form_state['values']['signup_reminder_days_before'] : 0,
      'send_reminder' => isset($form_state['values']['signup_send_reminder']) ? $form_state['values']['signup_send_reminder'] : 0,
      'reminder_email' => isset($form_state['values']['signup_reminder_email']) ? $form_state['values']['signup_reminder_email'] : '',
    ))
      ->condition('nid', 0)
      ->execute();
  }
  else {
    module_load_include('install', 'signup', 'signup');
    db_delete('signup')
      ->condition('nid', 0)
      ->execute();
    signup_insert_default_signup_info();
  }

  // Now, remove all the settings we just processed from our copy of
  // $form_state['values'], so system_settings_form_submit() doesn't see them.
  $settings = array(
    'signup_forwarding_email',
    'signup_send_confirmation',
    'signup_confirmation_email',
    'signup_send_reminder',
    'signup_reminder_days_before',
    'signup_reminder_email',
    'signup_close_signup_limit',
  );
  foreach ($settings as $setting) {
    unset($form_state['values'][$setting]);
  }

  // Remove the hidden element from signup_node_settings_form(), too.
  unset($form_state['values']['signup']);

  // Since the advanced settings can mess with the menu, rebuild that.
  menu_rebuild();

  // Let system_settings_form_submit() do its magic with everything else.
  system_settings_form_submit($form, $form_state);
}