You are here

function spam_admin_settings_actions in Spam 5

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

File

./spam.module, line 370

Code

function spam_admin_settings_actions() {

  // actions
  $form['actions'] = array(
    '#type' => 'fieldset',
    '#title' => 'Actions',
  );
  $form['actions']['spam_unpublish'] = array(
    '#type' => 'checkbox',
    '#title' => t('Unpublish spam'),
    '#return_value' => 1,
    '#default_value' => variable_get('spam_unpublish', 1),
    '#description' => t('When checked, any new content that is detected as spam will be automatically unpublished.  This will prevent the content from being displayed, allowing a site administrator a chance to first review it.'),
  );
  $form['actions']['spam_notify_user'] = array(
    '#type' => 'checkbox',
    '#title' => t('Notify user'),
    '#return_value' => 1,
    '#default_value' => variable_get('spam_notify_user', 1),
    '#description' => t('If both the above "Unpublish spam" box and this box are checked, users will be notified with a message when the content they post is blocked by the spam filter.  This is intended to minimize confusion when the spam filter mistakes a valid posting as spam and the posting doesn\'t immediately apear to the user.'),
  );
  $form['actions']['spam_notify_admin'] = array(
    '#type' => 'checkbox',
    '#title' => t('Email notification'),
    '#return_value' => 1,
    '#default_value' => variable_get('spam_notify_admin', 1),
    '#description' => t('Enabling this option will cause an email to be sent to the site administrator whenever the filters detect spam content.'),
  );
  $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['actions']['spam_expire_time'] = array(
    '#type' => 'select',
    '#title' => t('Expire spam after'),
    '#default_value' => variable_get('spam_expire_time', 1209600),
    '#options' => $period,
    '#description' => t('Content that is marked as spam for more than the selected amount of time will be automatically and permanently deleted.  Requires crontab.'),
  );

  // provide hook for external modules to define actions
  $updated = spam_invoke_hook('action_settings');
  if ($updated['group']) {
    $form['actions'] = array_merge($form['actions'], $updated['group']);
  }
  return system_settings_form($form);
}