You are here

function subscriptions_settings in Subscriptions 5

Admin settings

1 string reference to 'subscriptions_settings'
subscriptions_menu in ./subscriptions.module
Implementation of hook_menu().

File

./subscriptions.module, line 117

Code

function subscriptions_settings() {
  if (module_exists('taxonomy')) {
    $form['taxonomy'] = array(
      '#type' => 'fieldset',
      '#title' => t('Taxonomy settings'),
      '#collapsible' => TRUE,
    );
    $vocabularies = taxonomy_get_vocabularies();
    $select[0] = '<' . t('none') . '>';
    foreach ($vocabularies as $vocabulary) {
      $select[$vocabulary->vid] = $vocabulary->name;
    }
    $form['taxonomy']['subscriptions_omitted_taxa'] = array(
      '#type' => 'select',
      '#title' => t('Omitted vocabularies'),
      '#default_value' => variable_get('subscriptions_omitted_taxa', array()),
      '#options' => $select,
      '#description' => t('Select vocabularies which should be <strong>omitted</strong> from subscription listings.'),
      '#multiple' => TRUE,
    );

    // @ TODO write the code that supports this setting

    /*
    $form['taxonomy']['subscriptions_allow_vid'] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow vocabularies subscription'),
      '#default_value' => variable_get('subscriptions_allow_vid', 1),
      '#description' => t('Allow users to subscribe to an entire vocabluary of terms.'),
    );
    */
  }
  $select = array();
  $nodetypes = node_get_types();
  foreach ($nodetypes as $ntype => $nname) {
    $select[$ntype] = $nname->name;
  }
  $form['sub_settings']['subscriptions_omitted_content_types'] = array(
    '#type' => 'select',
    '#title' => t('Omitted content types'),
    '#default_value' => variable_get('subscriptions_omitted_content_types', array()),
    '#options' => $select,
    '#description' => t('Select content types which should be <strong>omitted</strong> from subscription listings.'),
    '#multiple' => TRUE,
  );
  $form['sub_settings']['email'] = array(
    '#type' => 'fieldset',
    '#title' => t('Email settings for subscriptions notification'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Note that themes are able to override these settings.'),
  );
  $form['sub_settings']['email']['subscriptions_email_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => variable_get('subscriptions_email_subject', SUBSCRIPTIONS_DEFAULT_SUBJECT),
  );
  $form['sub_settings']['email']['subscriptions_email_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#default_value' => variable_get('subscriptions_email_body', SUBSCRIPTIONS_DEFAULT_BODY),
    '#description' => t("You may use the following variables: @name (user's name), @type (node type subscribed to), !url (the url of the subscribed node), @site (the name of your site), !manage-url (the url to manage user's subscriptions), @title (the node's title), @teaser (the node's teaser)"),
    '#rows' => 15,
  );
  $form['sub_settings']['subscriptions_sendself'] = array(
    '#type' => 'checkbox',
    '#title' => t('Notify poster of own posts'),
    '#default_value' => variable_get('subscriptions_sendself', 0),
    '#description' => t("Notifies a node poster about their own posts.  Useful principally during testing.  Default is OFF."),
  );
  $form['sub_settings']['subscriptions_usecron'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use cron for notifications'),
    '#default_value' => variable_get('subscriptions_usecron', 0),
    '#description' => t("Sends subscription notification when cron module runs.  Default is to send upon node update.  <br /><em>Note:  Currently only tested with MySQL.</em>"),
  );
  $form['sub_settings']['subscriptions_watchgood'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display watchdog entries for successful mailings'),
    '#default_value' => variable_get('subscriptions_watchgood', 1),
    '#description' => t('Inserts notification of successful mailings in the watchdog log.  Default is ON.'),
  );
  $form['sub_settings']['subscriptions_testpost'] = array(
    '#type' => 'checkbox',
    '#title' => t('Test held posts prior to sending'),
    '#default_value' => variable_get('subscriptions_testpost', 0),
    '#description' => t('Tests to see if a post about to be sent by cron is still active.  Adds a small amount of overhead.  Default is OFF.'),
  );
  $form['sub_settings']['subscriptions_usersmenu'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Subscriptions users menu under "My account"'),
    '#default_value' => variable_get('subscriptions_usersmenu', 1),
    '#description' => t('Displays the Subscriptions users menu as a tab under "My account". Default is ON.'),
  );
  $form['sub_settings']['subscriptions_autoset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Set all users to "autosubscribe" by default'),
    '#default_value' => variable_get('subscriptions_autoset', 0),
    '#description' => t('Sets each users "autosubscribe" profile option. Default is OFF.'),
  );
  $form['sub_settings']['subscriptions_link_teaser'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show subscribe link with teaser'),
    '#default_value' => variable_get('subscriptions_link_teaser', 1),
    '#description' => t('Uncheck to show link only in node view.'),
  );
  return system_settings_form($form);
}