You are here

function mass_contact_admin_settings in Mass Contact 5.2

Same name and namespace in other branches
  1. 5 mass_contact.module \mass_contact_admin_settings()

Administration settings form.

Return value

An associative array that defines the form to be built.

1 string reference to 'mass_contact_admin_settings'
mass_contact_menu in ./mass_contact.module
Implementation of hook_menu().

File

./mass_contact.module, line 481
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() {
  $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'),
    )),
  );
  $form['mass_contact_character_set'] = array(
    '#type' => 'textfield',
    '#title' => t('Character set'),
    '#default_value' => variable_get('mass_contact_character_set', ''),
    '#description' => t('You may specify an alternate character set to use when sending e-mails. If left blank, the default of UTF-8 will be used. If you are unsure of what to put here, then leave it blank. Caution: setting this may not get you the results you desire. Other modules may come along and change that value after it has been set by this module.'),
  );
  $form['mass_contact_default_sender'] = array(
    '#type' => 'fieldset',
    '#title' => t('Default sender information'),
    '#description' => t('If anything is specified in here, it is used in place of the "Your name" and "Your e-mail address" fileds when sending the mass e-mail. Otherwise, the sender\'s name and e-mail address will be the default values. You must fill in both values, if you want to specify a default.'),
  );
  $form['mass_contact_default_sender']['mass_contact_default_sender_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Default sender name'),
    '#default_value' => variable_get('mass_contact_default_sender_name', ''),
    '#size' => 60,
    '#maxlength' => 128,
    '#description' => t('The optional user name to send e-mail as. Replaces the "Your name" value when sending mass e-mails.'),
  );
  $form['mass_contact_default_sender']['mass_contact_default_sender_email'] = array(
    '#type' => 'textfield',
    '#title' => t('Default sender e-mail address'),
    '#default_value' => variable_get('mass_contact_default_sender_email', ''),
    '#size' => 60,
    '#maxlength' => 128,
    '#description' => t('The optional user e-mail address to send e-mail as. Replaces the "Your e-mail address" value when sending mass e-mails.'),
  );
  $form['mass_contact_default_sender']['mass_contact_default_sender_changable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow the sender to change these values.'),
    '#default_value' => variable_get('mass_contact_default_sender_changable', 0),
    '#description' => t('If checked, gives the sender the ability of changing the default sender and e-mail address when creating the message. If unchecked, the fields will be disabled.'),
  );
  $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" will turn off this feature.'),
    '#required' => TRUE,
  );
  $form['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_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.'),
  );
  $form['mass_contact_bcc_d'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send as BCC (hide recipients) by default.'),
    '#default_value' => variable_get('mass_contact_bcc_d', 1),
  );
  $form['mass_contact_bcc_d_override'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow sender to override BCC setting.'),
    '#default_value' => variable_get('mass_contact_bcc_d_override', 1),
  );
  $form['mass_contact_category_override'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include category in subject line.'),
    '#default_value' => variable_get('mass_contact_category_override', 1),
  );
  $form['mass_contact_supplemental_texts'] = array(
    '#type' => 'fieldset',
    '#title' => t('Supplemental message body texts'),
    '#description' => t('You may specify additional text to insert before and/or after the message text of every mass e-mail that is sent.'),
  );
  if (module_exists('token')) {
    $form['mass_contact_supplemental_texts']['mass_contact_message_prefix'] = array(
      '#type' => 'textarea',
      '#title' => t('Text to be prepended to all messages'),
      '#default_value' => variable_get('mass_contact_message_prefix', t('[user-name] has sent you a mass e-mail from [site-name].')),
      '#description' => t('The text you specify above will be added to all e-mails sent out. The text will be placed before the message text entered in by the sender.'),
    );
    $form['mass_contact_supplemental_texts']['mass_contact_message_suffix'] = array(
      '#type' => 'textarea',
      '#title' => t('Text to be appended to all messages'),
      '#default_value' => variable_get('mass_contact_message_suffix', t('')),
      '#description' => t('The text you specify above will be added to all e-mails sent out. The text will be placed after the message text entered in by the sender.'),
    );
    $form['mass_contact_supplemental_texts']['mass_contact_replacement_tokens'] = array(
      '#type' => 'fieldset',
      '#title' => t('Replacement tokens'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#description' => t('You may use any of the following replacements tokens for use in the prefix and/or suffix texts above.'),
    );
    $form['mass_contact_supplemental_texts']['mass_contact_replacement_tokens']['token_help'] = array(
      '#value' => theme('token_help', 'global'),
    );
  }
  else {
    $form['mass_contact_supplemental_texts']['mass_contact_message_prefix'] = array(
      '#type' => 'textarea',
      '#title' => t('Text to be prepended to all messages'),
      '#default_value' => variable_get('mass_contact_message_prefix', t('You were sent a mass e-mail from !site.', array(
        '!site' => url(NULL, NULL, NULL, TRUE),
      ))),
      '#description' => t('The text you specify above will be added to all e-mails sent out. The text will be placed before the message text entered in by the sender.'),
    );
    $form['mass_contact_supplemental_texts']['mass_contact_message_suffix'] = array(
      '#type' => 'textarea',
      '#title' => t('Text to be appended to all messages'),
      '#default_value' => variable_get('mass_contact_message_suffix', t('')),
      '#description' => t('The text you specify above will be added to all e-mails sent out. The text will be placed after the message text entered in by the sender.'),
    );
  }
  $form['mass_contact_html_d'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send as HTML by default.'),
    '#default_value' => variable_get('mass_contact_html_d', 1),
    '#description' => t('This will use the default input filter as specified on the <a href="@formats_settings">Input formats settings</a> page.', array(
      '@formats_settings' => url('admin/settings/filters'),
    )),
  );
  $form['mass_contact_html_d_override'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow sender to override HTML setting.'),
    '#default_value' => variable_get('mass_contact_html_d_override', 1),
  );
  $form['mass_contact_number_of_attachments'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of attachments'),
    '#default_value' => variable_get('mass_contact_number_of_attachments', '3'),
    '#size' => 10,
    '#description' => t("The number of attachments to allow on the contact form. The maximum number of allowed uploads may be limited by PHP. If necessary, check your system's PHP php.ini file for a max_file_uploads directive to change."),
  );
  $form['mass_contact_attachment_location'] = array(
    '#type' => 'textfield',
    '#title' => t('Attachment location'),
    '#default_value' => variable_get('mass_contact_attachment_location', file_directory_path() . '/mass_contact_attachments'),
    '#description' => t('If a copy of the message is saved as a node, this is the file path where to save the attachment so it can be viewed later.'),
  );
  $form['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_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_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);
}