You are here

function comment_notify_settings in Comment Notify 5.2

Same name and namespace in other branches
  1. 5 comment_notify.module \comment_notify_settings()
  2. 6 comment_notify.module \comment_notify_settings()
  3. 7 comment_notify.module \comment_notify_settings()
1 string reference to 'comment_notify_settings'
comment_notify_menu in ./comment_notify.module
Implementation of hook_menu().

File

./comment_notify.module, line 509
This module provides comment follow-up e-mail notification for anonymous and registered users.

Code

function comment_notify_settings() {
  $form['comment_notify_settings'] = array();

  // Only perform comment_notify for certain node types (default, all)
  foreach (node_get_types('names') as $type => $name) {
    $checkboxes[$type] = check_plain($name);
    $default[] = $type;
  }
  if (variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
    $account = user_load(array(
      'uid' => 0,
    ));
    if (user_access('subscribe to comments', $account)) {
      drupal_set_message(t('Anonymous commenters have the permission to subscribe to comments but cannot leave their contact infromation. You should either revoke the <a href="!permission-url">permission for anonymous users</a>, or enable anonymous users to leave their contact information in the <a href="!comment-setting-url">comment settings.</a>', array(
        '!permission-url' => url('admin/user/access', NULL, 'module-comment_notify'),
        '!comment-setting-url' => url('admin/content/comment/settings'),
      )));
    }
  }
  $form['comment_notify_settings']['comment_notify_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types to enable for comment notification'),
    '#default_value' => variable_get('comment_notify_node_types', $default),
    '#options' => $checkboxes,
    '#description' => t('Comments on content types enabled here will have the option of comment notification.'),
  );
  $form['comment_notify_settings']['comment_notify_available_alerts'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Available subscription modes'),
    '#return_value' => 1,
    '#default_value' => variable_get('comment_notify_available_alerts', TRUE),
    '#description' => t('Choose which notification subscription styles are available for users'),
    '#options' => array(
      COMMENT_NOTIFY_NODE => t('For all comments on a post'),
      COMMENT_NOTIFY_COMMENT => t('Just for replies to a comment'),
    ),
  );
  $form['comment_notify_settings']['comment_notify_default_anon_mailalert'] = array(
    '#type' => 'select',
    '#title' => t('Default state for the notification selection box for anonymous users'),
    '#return_value' => 1,
    '#default_value' => variable_get('comment_notify_default_anon_mailalert', array(
      COMMENT_NOTIFY_NODE,
      COMMENT_NOTIFY_COMMENT,
    )),
    '#options' => array(
      COMMENT_NOTIFY_DISABLED => t('No notifications'),
      COMMENT_NOTIFY_NODE => t('For all comments on this post'),
      COMMENT_NOTIFY_COMMENT => t('Just for replies to my comment'),
    ),
  );
  $form['comment_notify_settings']['comment_notify_default_mailtext'] = array(
    '#type' => 'textarea',
    '#title' => t('Default mail text for sending out notifications to commenters.'),
    '#description' => t('You can use the following variables to be replaced:
      <ul>
      <li>!commname = the username who posted the comment
      <li>!commtext = the text of the posted comment
      <li>!commsubj = the subject of the posted comment
      <li>!comment_url = the full url of the post and comment - note: if you have paging enabled, this does not work correct - set your max comments per page so that all fit on one page or reverse order them
      <li>!node_title = the title of the node that was commented on
      <li>!node_teaser = the teaser of the node that was commented on
      <li>!node_body = the body of the node that was commented on
      <li>!mission = site_mission text
      <li>!name = username receiving the alert
      <li>!site = your site
      <li>!uri = base_url of site
      <li>!uri_brief = base_url of site w/o http
      <li>!date = the current time
      <li>!login_uri  uri to login the user
      <li>!edit_uri = uri to edit user profile
      <li>!link1 the QUICKLINK to disable future follow-up otifications for the user
      </ul>'),
    '#default_value' => variable_get('comment_notify_default_mailtext', t(DEFAULT_MAILTEXT)),
    '#return_value' => 1,
    '#cols' => 80,
    '#rows' => 15,
  );
  $form['comment_notify_settings']['node_notify_default_mailtext'] = array(
    '#type' => 'textarea',
    '#title' => t('Default mail text for sending out the notifications to node authors'),
    '#description' => t('You can use the following variables to be replaced:
      <ul>
      <li>!commname = the username who posted the comment
      <li>!commtext = the text of the posted comment
      <li>!commsubj = the subject of the posted comment
      <li>!comment_url = the full url of the post and comment - note: if you have paging enabled, this does not work correct - set your max comments per page so that all fit on one page or reverse order them
      <li>!node_title = the title of the node that was commented on
      <li>!node_teaser = the teaser of the node that was commented on
      <li>!node_body = the body of the node that was commented on
      <li>!mission = site_mission text
      <li>!name = username receiving the alert
      <li>!site = your site
      <li>!uri = base_url of site
      <li>!uri_brief = base_url of site w/o http
      <li>!date = the current time
      <li>!login_uri  uri to login the user
      <li>!edit_uri = uri to edit user profile
      </ul>'),
    '#default_value' => variable_get('node_notify_default_mailtext', t(AUTHOR_MAILTEXT)),
    '#return_value' => 1,
    '#cols' => 80,
    '#rows' => 15,
  );
  return system_settings_form($form);
}