You are here

function notify_admin_settings in Notify 6

Same name and namespace in other branches
  1. 5.2 notify.module \notify_admin_settings()
  2. 5 notify.module \notify_admin_settings()
  3. 7 notify.admin.inc \notify_admin_settings()

Menu callback; display notify settings page.

1 string reference to 'notify_admin_settings'
notify_menu in ./notify.module
Implementation of hook_menu().

File

./notify.module, line 33
Notify module sends email digests of new content and comments.

Code

function notify_admin_settings() {
  $period = array(
    900 => format_interval(900),
    1800 => format_interval(1800),
    3600 => format_interval(3600),
    10800 => format_interval(10800),
    21600 => format_interval(21600),
    32400 => format_interval(32400),
    43200 => format_interval(43200),
    86400 => format_interval(86400),
    172800 => format_interval(172800),
    259200 => format_interval(259200),
    604800 => format_interval(604800),
    1209600 => format_interval(1209600),
    2419200 => format_interval(2419200),
    -1 => t('Never'),
  );
  $form = array();
  $form['notify_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('E-mail notification settings'),
    '#collapsible' => TRUE,
  );
  $form['notify_settings']['notify_send'] = array(
    '#type' => 'select',
    '#title' => t('Send notifications every'),
    '#default_value' => variable_get('notify_send', array(
      86400,
    )),
    '#options' => $period,
    '#description' => t('How often should new content notifications be sent? Requires cron to be running at least this often.'),
  );
  $form['notify_settings']['notify_send_hour'] = array(
    '#type' => 'select',
    '#title' => t('Hour to Send Notifications'),
    '#description' => t('Specify the hour (24-hour clock) in which notifications should be sent, if the frequency is one day or greater.'),
    '#default_value' => variable_get('notify_send_hour', 9),
    '#options' => array(
      0,
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15,
      16,
      17,
      18,
      19,
      20,
      21,
      22,
      23,
    ),
  );
  $form['notify_settings']['notify_attempts'] = array(
    '#type' => 'select',
    '#title' => t('Number of failed sends after which notifications are disabled'),
    '#default_value' => variable_get('notify_attempts', array(
      5,
    )),
    '#options' => array(
      t('Disabled'),
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      15,
      20,
    ),
  );
  $form['notify_settings']['notify_reg_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Notification checkbox default on new user registration form'),
    '#return_value' => 1,
    '#default_value' => variable_get('notify_reg_default', 1),
  );
  $form['notify_settings']['notify_include_updates'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include updated posts in notifications'),
    '#return_value' => 1,
    '#default_value' => variable_get('notify_include_updates', 1),
  );
  $set = 'ntype';
  $form[$set] = array(
    '#type' => 'fieldset',
    '#title' => t('Notification by node type'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t('Having nothing checked defaults to sending notifications about all node types.'),
  );
  foreach (node_get_types('types', array()) as $type => $object) {
    $form[$set][NOTIFY_NODE_TYPE . $type] = array(
      '#type' => 'checkbox',
      '#title' => $object->name,
      '#return_value' => 1,
      '#default_value' => variable_get(NOTIFY_NODE_TYPE . $type, 0),
    );
  }
  return system_settings_form($form);
}