You are here

function spam_admin_settings_advanced in Spam 5

1 string reference to 'spam_admin_settings_advanced'
spam_menu in ./spam.module
Implementation of hook_menu().

File

./spam.module, line 420

Code

function spam_admin_settings_advanced() {

  // advanced settings
  $form['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => 'Advanced',
  );
  $form['advanced']['spam_log_level'] = array(
    '#type' => 'radios',
    '#title' => t('Log'),
    '#default_value' => variable_get('spam_log_level', SPAM_LOG),
    '#options' => array(
      0 => t('nothing'),
      SPAM_LOG => t('major events'),
      SPAM_VERBOSE => t('major and minor events'),
      SPAM_DEBUG => t('everything'),
    ),
    '#description' => t('By default, the spam module will only log major events.  If you are trying to figure out why the spam filter is marking content as spam or not spam, you may want to try logging everything.  If you\'re concerned about performance, you may want to disable logging completely.'),
  );
  $period = drupal_map_assoc(array(
    0,
    3600,
    10800,
    21600,
    32400,
    43200,
    86400,
    172800,
    259200,
    604800,
    1209600,
    2419200,
    4838400,
    9676800,
    31536000,
  ), 'format_interval');
  $period[0] = t('never');
  $form['advanced']['spam_flush_log_timer'] = array(
    '#type' => 'select',
    '#title' => t('Discard spam logs older than'),
    '#default_value' => variable_get('spam_flush_log_timer', 259200),
    '#options' => $period,
    '#description' => t('Older spam log entries will be automatically discarded.  Requires crontab.'),
  );
  $form['advanced']['spam_display_probability'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display probability'),
    '#return_value' => 1,
    '#default_value' => variable_get('spam_display_probability', 0),
    '#description' => t('If enabled, the probability that a given piece of content is spam will be displayed by the content.  This is useful while you are tuning your spam filter, and will provide a link to the relevant logs showing how that content was determined to be or not to be spam.'),
  );
  $form['advanced']['spam_report_feedback'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require feedback when reporting spam'),
    '#return_value' => 1,
    '#default_value' => variable_get('spam_report_feedback', TRUE),
    '#description' => t('If checked, users that are able to report content as spam will be required to leave feedback when reporting spam.  If unchecked, users will not be prompted to leave feedback.'),
  );

  /* If you feel you need to display more than 50 spam comments or spam nodes
   * at a time, uncomment the following two lines of code.  For most people
   * this will be unnecessary, and potentially confusing, so by default I am
   * disabling this functionality.
   */

  //$quantity = array(5 => 5, 10 => 10, 25 => 25, 50 => 50, 100 => 100, 250 => 250, 500 => 500, 1000 => 1000, 5000 => 5000, 1000000 => t('all'));

  //$form['advanced']['spam_display_quantity'] = array(

  //  '#type' => 'select',
  //  '#title' => t('Quantity to display in lists'),
  //  '#default_value' => variable_get('spam_display_quantity', 50),
  //  '#options' => $quantity,
  //  '#description' => t('Select the number of spam comments or other types of content to display per page in the administrative interfaces.'),

  //);

  // provide hook for external modules to define custom advanced settings
  $hook = spam_invoke_hook('advanced_settings');
  if ($hook['group']) {
    $group .= $hook['group'];
    $form['advanced'] = array_merge($form['advanced'], $hook['group']);
  }
  return system_settings_form($form);
}