You are here

function mass_contact_admin_settings_misc in Mass Contact 6

Same name and namespace in other branches
  1. 7 mass_contact.admin.inc \mass_contact_admin_settings_misc()

Miscellaneous administration settings form.

Parameters

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

Return value

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
Implementation of hook_menu().

File

./mass_contact.module, line 640
This is the main code file for the Mass Contact module. This module enables users to contact multiple users through selected roles.

Code

function mass_contact_admin_settings_misc($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 e-mails 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.
  if (module_exists('drupal_queue')) {
    $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 e-mail'),
      '#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).'),
    );
  }
  else {

    // The maximum number of users to send to at one time.
    $form['mass_contact_recipient_limit'] = array(
      '#type' => 'textfield',
      '#title' => t('Maximum number of recipients before splitting up the e-mail'),
      '#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,
    );
  }

  ////////////////////////////////////////////////////////////

  // 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 e-mails'),
    '#default_value' => variable_get('mass_contact_optout_d', 0),
    '#options' => array(
      0 => 'No',
      1 => 'Yes',
      2 => 'Selected categories',
    ),
    '#description' => t("Allow users to opt-out of receiving mass e-mails. If 'No' is chosen, then the site's users will not be able to opt-out of receiving mass e-mails. If 'Yes' is chosen, then the site's users will be able to opt-out of receiving mass e-mails, 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 e-mails 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 e-mails from privileged users. Note that site administrators are able to include you in mass e-mails 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_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node copy options'),
  );
  $form['mass_contact_nodecc_options']['mass_contact_nodecc_d'] = array(
    '#type' => 'checkbox',
    '#title' => t('Save a copy as a node by default.'),
    '#default_value' => variable_get('mass_contact_nodecc_d', 1),
  );
  $form['mass_contact_nodecc_options']['mass_contact_nodecc_d_override'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow sender to override node copy setting.'),
    '#default_value' => variable_get('mass_contact_nodecc_d_override', 1),
  );
  $form['mass_contact_nodecc_options']['mass_contact_nodecc_include_categories'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include the category(ies) in the saved node.'),
    '#default_value' => variable_get('mass_contact_nodecc_include_categories', 1),
    '#description' => t('When saving a copy of the sent message as a node, include the categories the message was sent to in the body of the node.'),
  );
  $form['mass_contact_nodecc_options']['mass_contact_nodecc_include_roles'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include the role(s) specified by the categoy(ies) in the saved node.'),
    '#default_value' => variable_get('mass_contact_nodecc_include_roles', 1),
    '#description' => t('When saving a copy of the sent message as a node, include the roles that were selected by the chosen categories the message was sent to in the body of the node.'),
  );
  $form['mass_contact_nodecc_options']['mass_contact_nodecc_include_to_recipients'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include the recipients in the To field in the saved node.'),
    '#default_value' => variable_get('mass_contact_nodecc_include_to_recipients', 1),
    '#description' => t('When saving a copy of the sent message as a node, include the recipients from the To field the message was sent to in the body of the node. These are the recipients that are NOT hidden. This will not add the recipient from the To field if the recipients were hidden, as that is ths same as the person who sent the message.'),
  );
  $form['mass_contact_nodecc_options']['mass_contact_nodecc_include_bcc_recipients'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include the recipients in the BCC field in the saved node.'),
    '#default_value' => variable_get('mass_contact_nodecc_include_bcc_recipients', 0),
    '#description' => t('When saving a copy of the sent message as a node, include the recipients from the BCC field the message was sent to in the body of the node. These are the recipients that ARE hidden. This will not add the recipient from the To field, as that is ths same as the person who sent the message.'),
  );

  ////////////////////////////////////////////////////////////

  // Flood control options.
  $form['mass_contact_hourly_threshold'] = array(
    '#type' => 'select',
    '#title' => t('Hourly threshold'),
    '#options' => drupal_map_assoc(array(
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      15,
      20,
      25,
      30,
      40,
      50,
      75,
      100,
    )),
    '#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);
}