You are here

function mass_contact_admin_settings_misc in Mass Contact 7

Same name and namespace in other branches
  1. 6 mass_contact.module \mass_contact_admin_settings_misc()

Miscellaneous administration settings form.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: A keyed array containing the current state of the form.

Return value

array An associative array that defines the form to be built.

1 string reference to 'mass_contact_admin_settings_misc'
mass_contact_menu in ./mass_contact.module
Implements hook_menu().

File

./mass_contact.admin.inc, line 295
The administrative settings pages.

Code

function mass_contact_admin_settings_misc(array $form, array $form_state) {

  // Instructional text.
  $form['mass_contact_form_information'] = array(
    '#type' => 'textarea',
    '#title' => t('Additional information for Mass Contact form'),
    '#default_value' => variable_get('mass_contact_form_information', t('Send email messages using the following form.')),
    '#description' => t('Information to show on the <a href="@form">Mass Contact page</a>.', array(
      '@form' => url('mass_contact'),
    )),
  );

  // Rate limiting options.
  $form['mass_contact_rate_limiting_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Rate limiting options'),
    '#description' => t('By combining the two options below, messages sent through this module will be queued to be sent drung cron runs. Keep in mind that if you set your number of recipients to be the same as your limit, messages from this or other modules may be blocked by your hosting provider.'),
  );

  // The maximum number of users to send to at one time.
  $form['mass_contact_rate_limiting_options']['mass_contact_recipient_limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum number of recipients before splitting up the email'),
    '#size' => 10,
    '#default_value' => variable_get('mass_contact_recipient_limit', 0),
    '#description' => t('This is a workaround for server-side limits on the number of recipients in a single mail message. Once this limit is reached, the recipient list will be broken up and multiple copies of the message will be sent out until all recipients receive the mail. Setting this to 0 (zero) will turn this feature off.'),
    '#required' => TRUE,
  );

  // The maximum number of users to send to at one time.
  $form['mass_contact_rate_limiting_options']['mass_contact_send_with_cron'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send messages with Cron'),
    '#default_value' => variable_get('mass_contact_send_with_cron', 0),
    '#description' => t('This is another workaround for server-side limits. Check this box to delay sending until the next Cron run(s).'),
  );

  // Opt out options.
  $form['mass_contact_optout_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Opt-out options'),
  );
  $form['mass_contact_optout_options']['mass_contact_optout_d'] = array(
    '#type' => 'radios',
    '#title' => t('Allow users to opt-out of mass email messages'),
    '#default_value' => variable_get('mass_contact_optout_d', 0),
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
      2 => t('Selected categories'),
    ),
    '#description' => t("Allow users to opt-out of receiving mass email messages. If 'No' is chosen, then the site's users will not be able to opt-out of receiving mass email messages. If 'Yes' is chosen, then the site's users will be able to opt-out of receiving mass email messages, and they will not receive any from any category. If 'Selected categories' is chosen, then the site's users will be able to opt-out of receiving mass email messages from which ever categories they choose."),
  );
  $form['mass_contact_optout_options']['mass_contact_optout_message'] = array(
    '#type' => 'textarea',
    '#title' => t('The message to display to users when giving them the option to opt out'),
    '#default_value' => variable_get('mass_contact_optout_message', t('Allows you to opt-out of receiving mass email messages from privileged users. Note that site administrators are able to include you in mass email messages even if you choose not to enable this feature, and the ability to opt-out may be removed by the administrator at any time.')),
    '#description' => t('This is the message users will see in thier account settings page when they are presented with a list of categories to opt out of.'),
  );

  // Node copy options.
  $form['mass_contact_nodecc_d'] = array(
    '#type' => 'checkbox',
    '#title' => t('Archive messages by saving a copy as a node'),
    '#default_value' => variable_get('mass_contact_nodecc_d', 1),
  );

  // Flood control options.
  $form['mass_contact_hourly_threshold'] = array(
    '#type' => 'textfield',
    '#size' => 10,
    '#title' => t('Hourly threshold'),
    '#default_value' => variable_get('mass_contact_hourly_threshold', 3),
    '#description' => t('The maximum number of Mass Contact form submissions a user can perform per hour.'),
  );
  return system_settings_form($form);
}