comment_notify.module 24 KB
Newer Older
1 2 3 4 5
<?php
// $Id$

/**
 * @file
6 7
 *
 * This module provides comment follow-up e-mail notification for anonymous and registered users.
8 9
 */

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

define('AUTHOR_MAILTEXT',
'Hi !name,

You have received a comment on: "!node_title"

You can view the comment at the following url
!comment_url

You will receive emails like this for all replies to your posts. You can disable this by logging in and going to your account settings.

Webmaster of !site
!mission
!uri');

25 26
define('DEFAULT_MAILTEXT',
'Hi !name,
27

28
!commname has commented on: "!node_title"
29 30 31

The post is about
----
32
!node_teaser
33 34 35
----

You can view the comment at the following url
36
!comment_url
37

38
You can stop receiving emails when someone replies to this post,
39
by going to !link1
40

41
If you have auto-following enabled in your account, you will receive emails like this for all replies to a blog post you commented on. You can disable this by logging in and going to your account settings or unchecking the flag at the time you post the comment.
42

43
You can set up auto-following feature for all future posts
44
by creating your own user with a few clicks here !uri/user/register
45 46 47

Thanks for your feedback,

48 49 50
Webmaster of !site
!mission
!uri');
51

52 53 54 55
define('COMMENT_NOTIFY_DISABLED', 0);
define('COMMENT_NOTIFY_NODE', 1);
define('COMMENT_NOTIFY_COMMENT', 2);

56 57 58
/**
 * Implementation of hook_help().
 */
59 60
function comment_notify_help($path, $arg) {
  switch ($path) {
61
    case 'admin/modules#description':
62
      return t('Comment follow-up e-mail notification for anonymous and registered users.');
63 64 65 66
      break;
  }
}

67
/**
68
 * Insert our checkbox, add a submit button, and populate fields.
69
 */
70
function comment_notify_form_alter(&$form, &$form_state, $form_id) {
71 72
  global $user;

73 74
  // Only do alter the form if it's a comment form and the user has the permission to subscribe
  if ($form_id != 'comment_form' || !user_access('Subscribe to comments')) {
75 76
    return;
  }
77

78 79
  // Only add the checkbox if this is an enabled content type
  $node = node_load($form['nid']['#value']);
80 81
  $enabled_types = variable_get('comment_notify_node_types', array($node->type => TRUE));
  if (empty($enabled_types[$node->type])) {
82
    return;
83
  }
84

85
  // If this is a POST then it is a preview and we remind people that there post isn't done yet.
86 87 88
  $op = isset($_POST['op']) ? $_POST['op'] : '';

  if ($op == t('Preview comment')) {
89
    drupal_set_message(t('ATTENTION: Your comment is NOT YET posted - please click the post button to confirm your post'));
90 91 92 93

    //extra submit button on top
    if (!form_get_errors() && ((variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview comment')) || ($op == t('Post comment')))) {
      $form['submitextra'] = array(
94 95 96 97 98
        '#type' => 'fieldset',
        '#title' => t('Comment is not posted yet - please click post button to confirm your post'),
        '#weight' => -99,
        '#collapsible' => FALSE
      );
99

100 101 102 103 104
      $form['submitextra']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Post comment'),
        '#weight' => -20
      );
105 106 107
    }
  }

108 109 110 111 112 113 114 115 116 117 118 119 120 121
  $total_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')
  );

  // Always allow disabled
  $options[] = COMMENT_NOTIFY_DISABLED;
  $options = array_merge($options, variable_get('comment_notify_available_alerts', array(COMMENT_NOTIFY_NODE, COMMENT_NOTIFY_COMMENT)));

  foreach($options as $available) {
    $available_options[$available] = $total_options[$available];
  }

122
  // Add the checkbox for anonymous users and set the default based on admin settings.
123
  if ($user->uid == 0) {
124 125 126 127
    // If anonymous user's can't enter their e-mail don't tempt them with the checkbox
    if (empty($form['mail'])) {
      return;
    }
128
    $form['notify'] = array(
129
      '#type' => 'select',
130
      '#title' => t('Notify me of follow-up comments posted here'),
131 132
      '#default_value' => variable_get('comment_notify_default_anon_mailalert', FALSE),
      '#options' => $available_options,
133 134
    );
  }
135
  // For registered users and the admin wants them to see the checkbox.
136 137
  elseif (variable_get('comment_notify_regged_checkbox', TRUE)) {
    $form['notify'] = array(
138
      '#type' => 'select',
139
      '#title' => t('Notify me of follow-up comments posted here.'),
140 141
      '#default_value' => !empty($user->comment_notify_mailalert) ? $user->comment_notify_mailalert : variable_get('comment_notify_default_anon_maila\
lert', FALSE),
142
      '#description' => t('You can change the default for this field in "Comment follow-up notification settings" on <a href="!uri">your account edit page</a>', array('!uri' => url('user/'. $user->uid .'/edit'))),
143
      '#options' => $available_options,
144 145
    );
  }
146
  // For the registered users where the admin wants the checkbox hidden.
147
  else {
148
    $form['notify'] = array(
149 150
      '#type' => 'hidden',
      '#title' => t('Mail me updates to this comment.'),
151
      '#default_value' => $user->comment_notify_mailalert,
152 153
    );
  }
154
  // If this is an existing comment we set the default value based on their selection last time.
155
  if ($form['cid']['#value'] != '') {
156 157
    $notify = db_result(db_query("SELECT notify FROM {comment_notify} WHERE cid = %d", $form['cid']['#value']));
    $form['notify']['#default_value'] = $notify;
158 159
  }
}
160

161
/**
162
 * Implementation of hook_perm().
163 164
 */
function comment_notify_perm() {
165
  return array('Administer comment notify', 'Subscribe to comments');
166
}
167 168 169 170

/**
 * Implementation of hook_menu().
 */
171 172 173
function comment_notify_menu() {

  $items['admin/settings/comment_notify'] = array(
174
    'title' => 'Comment notify',
175 176 177 178
    'description' => 'Configure settings for e-mails about new comments.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('comment_notify_settings'),
    'access arguments' => array('Administer comment notify'),
179
    'type' => MENU_NORMAL_ITEM,
180
  );
181
  $items['admin/settings/comment_notify/settings'] = array(
182 183 184 185 186 187 188
    'title' => 'Settings',
    'description' => 'Configure settings for e-mails about new comments.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('comment_notify_settings'),
    'access arguments' => array('Administer comment notify'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
189
  
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
  $items['admin/settings/comment_notify/unsubscribe'] = array(
    'title' => 'Unsubscribe',
    'description' => 'Unsubscribe an email from all notifications.',
    'weight' => 2,
    'page callback' => 'drupal_get_form',
    'page arguments' => array('comment_notify_unsubscribe'),
    'access arguments' => array('Administer comment notify'),
    'type' => MENU_LOCAL_TASK,
  );
  $items['comment_notify'] = array(
    'title' => 'comment notify',
    'page callback' => 'comment_notify_page',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK
  );
205 206 207 208

  return $items;
}

209 210 211
/**
 * Page callback to allow users to unsubscribe simply by visiting the page.
 */
212 213 214
function comment_notify_page() {
  global $user;

215 216
  $op = $_POST['op'];
  $edit = $_POST['edit'];
217

218
  $page_content = ' ';
219 220 221 222 223 224 225
  if (empty($op)) {
    $op = arg(1);
  }
  $arg = arg(2);

  switch ($op) {
    case 'disable':
226
      $key = $arg;
227
      db_query("UPDATE {comment_notify} c SET c.notify = 0 WHERE notify_hash = '%s'", $arg);
228 229 230

      drupal_set_message(t('Your comment follow-up notification for this post was disabled. Thanks.'));
      $title = t('Disabled comment follow-up notification feature for this post.');
231 232
      break;
    default;
233
      $title = t('Comment notify');
234 235
      break;
  }
236

237
  drupal_set_title($title);
238
  return $page_content;
239 240
}

241
/**
242
 * Implementation of hook_comment().
243 244 245 246
 */
function comment_notify_comment($comment, $op) {
  global $user;

247
  switch ($op) {
248
    case 'validate':
249 250
       // We assume that if they are non-anonymous then they have a valid mail.
       // For anonymous users, though, we verify that they entered a mail and let comment.module validate it is real.
251 252 253 254
      if (!$user->uid && $comment['notify'] && empty($comment['mail'])) {
        form_set_error('mail', t('If you want to subscribe to comments you must supply a valid e-mail address.'));
      }
      break;
255
    case 'publish':
256
      // The real meat of the module.
257 258 259
      _comment_notify_mailalert($comment);
      break;
    case 'update':
260
      // In case they have changed their status, save it in the database.
261
      $sql = 'UPDATE {comment_notify} SET notify = %d WHERE cid = %d';
262
      db_query($sql, $comment['notify'], $comment['cid']);
263
      break;
264
    case 'insert':
265
      // For new comments, we first build up a string to be used as the identifier for the alert
266
      $mail = empty($comment['mail']) ? $user->mail : $comment['mail'];
267
      $notify_hash = drupal_get_token($mail . $comment['cid']);
268
      // And then save the data.
269
      db_query("INSERT INTO {comment_notify} (cid, notify, notify_hash) values (%d, %d, '%s')", $comment['cid'], $comment['notify'], $notify_hash);
270
      break;
271 272 273
    case 'delete':
      db_query("DELETE FROM {comment_notify} WHERE cid = %d", $comment->cid);
      break;
274 275 276 277 278 279 280 281 282
  }
}

/**
 * Implementation of hook_user().
 */
function comment_notify_user($type, &$edit, &$user, $category = NULL) {
  switch ($type) {
    case 'form':
283
      if ($category == 'account' && user_access('Subscribe to comments', $user)) {
284 285
        $form = array();
        $form['comment_notify_settings'] = array(
286 287 288 289 290 291
          '#type' => 'fieldset',
          '#title' => t('Comment follow-up notification settings'),
          '#weight' => 4,
          '#collapsible' => TRUE
        );

292 293 294 295 296 297 298
        $form['comment_notify_settings']['node_notify_mailalert'] = array(
          '#type' => 'checkbox',
          '#title' => t('Receive node follow-up notification e-mails'),
          '#default_value' => isset($edit['node_notify_mailalert']) ? $edit['node_notify_mailalert'] : FALSE,
          '#description' => t('Check this box to receive an e-mail notification for follow-ups on your nodes (pages, forum topics, etc). You can not disable notifications for individual threads.')
        );

299
        $form['comment_notify_settings']['comment_notify_mailalert'] = array(
300
          '#type' => 'select',
301
          '#title' => t('Receive comment follow-up notification e-mails'),
302
          '#default_value' => isset($edit['comment_notify_mailalert']) ? $edit['comment_notify_mailalert'] : FALSE,
303 304 305 306 307
          '#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')
          ),
308
          '#description' => t("Check this box to receive e-mail notification for follow-up comments to comments you posted. You can later disable this on a post-by-post basis... so if you leave this to YES, you can still disable follow-up notifications for comments you don't want follow-up mails anymore - i.e. for very popular posts.")
309
        );
310 311
        return $form;
      }
312

313 314 315 316
      break;
  }
}

317 318
/**
 * Private function to send the notifications.
greggles's avatar
greggles committed
319
 *
320 321 322
 * @param $comment
 *   The comment array as found in hook_comment $op = publish.
 */
323 324
function _comment_notify_mailalert($comment) {
  $comment = (object) $comment;
325
  global $language;
326
  global $base_url;
327
  global $user;
328

329
  $initial_language = $language;
330

331
  if (function_exists('locale')) {
332
    $languages = locale_language_list();
333 334 335
    $languages = $languages['name'];
  }

336 337 338 339
  $nid = $comment->nid;
  $cid = $comment->cid;
  $node = node_load($nid);
  if (!isset($comment->mail)) {
340
    $comment_account = user_load(array('name' => $comment->name));
341 342 343 344 345
    $comment_mail = $comment_account->mail;
  }
  else {
    $comment_mail = $comment->mail;
  }
346
  $sent_to = array();
greggles's avatar
greggles committed
347
  $subject = t('!site :: new comment for your post.', array('!site' => variable_get('site_name', 'drupal')));
348 349 350 351 352 353 354

  // Send to a subscribed author if they are not the current commenter
  $author = user_load(array('uid' => $node->uid));
  if ($author->node_notify_mailalert == 1 && $user->mail != $author->mail) {
    $message = t(
      variable_get('node_notify_default_mailtext', AUTHOR_MAILTEXT),
      array(
355 356 357
        '!commname' => $comment->name,
        '!commtext' => $comment->comment,
        '!commsubj' => $comment->subject,
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
        '!comment_url' => url('node/'. $nid, NULL, NULL, 1) .'#comment-'. $cid,
        '!node_title' =>  $node->title,
        '!node_teaser' => $node->teaser,
        '!mission' => variable_get('site_mission', ''),
        '!node_body' =>  $node->body,
        '!name' => $author->name,
        '!site' => variable_get('site_name', 'drupal'),
        '!uri' => $base_url,
        '!uri_brief' => substr($base_url, strlen('http://')),
        '!date' => format_date(time()),
        '!login_uri' => url('user', NULL, NULL, 1),
        '!edit_uri' => url('user/'. $alert->uid .'/edit', NULL, NULL, 1)
      )
    );
    drupal_mail('node_notify_mail', $author->mail, $subject, $message, $from, array());
    $sent_to[] = $author->mail;
  }
 
  //Get the list of commenters to notify
377
  $result = db_query("SELECT DISTINCT c.cid, c.uid, c.name, c.nid, c.mail AS cmail, u.mail AS umail, u.init AS uinit, c.uid, c.name, cn.notify, cn.notify_hash
378
    FROM {comments} c INNER JOIN {comment_notify} cn on c.cid = cn.cid LEFT OUTER JOIN {users} u ON c.uid = u.uid
379
    WHERE nid = %d AND cn.notify > 0 AND c.status = 0 AND (u.status = 1 OR u.uid = 0)", $nid
380
  );
381
  // TODO? the original big query had stuff making sure the mail was populated and contained .+@.+ Perhaps check for that here and set notify = 0 if that is the case for this cid
382

383
  while ($alert = db_fetch_object($result)) {
384 385 386
    $umail = empty($alert->umail) ? $alert->uinit : $alert->umail;
    $mail = empty($alert->cmail) ? $umail : $alert->cmail;

387 388 389 390
    if ($alert->notify == COMMENT_NOTIFY_COMMENT && $alert->cid != $comment->pid) {
      break;
    }

391
    if ($mail != $comment_mail && !in_array($mail, $sent_to) && $alert->uid != $comment->uid) {
392 393
      $message = array();
      if (!empty($alert->uid)) {
greggles's avatar
greggles committed
394
        $recipient_user = user_load(array('uid' => $alert->uid));
395 396 397 398
        $language = user_preferred_language($recipient_user);
      }
      else {
        $language = language_default();
399
      }
400

401
      $message['subject'] = t('!site :: new comment for your post.', array('!site' => variable_get('site_name', 'drupal')));
402
      $message['body'] = t(
403 404
        variable_get('comment_notify_default_mailtext', DEFAULT_MAILTEXT),
        array(
405 406 407
          '!commname' => $comment->name,
          '!commtext' => $comment->comment,
          '!commsubj' => $comment->subject,
408
          '!comment_url' => url('node/'. $nid, array('absolute' => TRUE)) .'#comment-'. $cid,
409 410 411 412 413 414 415
          '!node_title' =>  $node->title,
          '!node_teaser' => $node->teaser,
          '!mission' => variable_get('site_mission', ''),
          '!node_body' =>  $node->body,
          '!name' => $alert->name,
          '!site' => variable_get('site_name', 'drupal'),
          '!uri' => $base_url,
greggles's avatar
greggles committed
416
          '!uri_brief' => drupal_substr($base_url, drupal_strlen('http://')),
417
          '!date' => format_date(time()),
418 419
          '!login_uri' => url('user', array('absolute' => TRUE)),
          '!edit_uri' => url('user/'. $alert->uid .'/edit', array('absolute' => TRUE)),
420
          '!link1' => url('comment_notify/disable/'. $alert->notify_hash, array('absolute' => TRUE))
421
        )
422
      );
423
      drupal_mail('comment_notify', 'comment_notify_mail', $mail, $language, $message);
424
      $sent_to[] = $mail;
425

426
      if ($alert->uid != 0) {
427
        $watchdog_message = 'Notified: <a href="!url">@user_mail</a>';
428 429
      }
      else {
430
        $watchdog_message = 'Notified @user_mail';
431
      }
432

433
      watchdog('comment_notify', $watchdog_message, array('!url' => url('user/'. $alert->uid .'/edit'), '@user_mail' => $mail),
434
        WATCHDOG_NOTICE, l(t('source comment'), 'node/'. $nid, array('fragment' => 'comment-'. $alert->cid)));
435

436 437
      // Add an entry to the watchdog log.

438
      // revert to previous (site default) locale
439
      $language = $initial_language;
440 441 442 443
    }
  }
}

444 445
function comment_notify_mail($key, &$message, $params) {
  $message['subject'] = $params['subject'];
446
  $message['body'][] = $params['body'];
447 448 449
}


450
/**
451
 * Callback for an administrative form to unsubscribe users by e-mail address.
452 453 454 455 456 457 458 459 460 461 462 463 464
 */
function comment_notify_unsubscribe() {
  $form['comment_notify_unsubscribe'] = array();
  $form['comment_notify_unsubscribe']['email_to_unsubscribe'] = array(
    '#type' => 'textfield',
    '#title' => t('Email to unsubscribe'),
  );
  $form['comment_notify_unsubscribe']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Unsubscribe this e-mail'),
  );
  return $form;
}
465

466
/**
467
 * Based on admin submit, do the actual unsubscribe from notifications.
468
 */
469 470
function comment_notify_unsubscribe_submit($form, &$form_state) {
  $email = trim($form_state['values']['email_to_unsubscribe']);
471
  // If they have a uid, use that, otherwise update comments directly
472
  $result = db_result(db_query_range("SELECT uid FROM {users} WHERE mail = '%s'", $email, 0, 1));
473
  if ($result > 0) {
474
    $comments = db_result(db_query("SELECT COUNT(1) FROM {comments} c INNER JOIN {comment_notify} cn ON c.cid = cn.cid WHERE c.uid = %d AND cn.notify > 0", $result));
475
    db_query("UPDATE {comment_notify} cn INNER JOIN {comments} c ON cn.cid = c.cid SET cn.notify = 0 WHERE c.uid = %d", $result);
476 477
  }
  else {
478
    $comments = db_result(db_query("SELECT COUNT(1) FROM {comments} c INNER JOIN {comment_notify} cn ON c.cid = cn.cid WHERE c.mail = '%s' AND cn.notify > 0", $email));
479
    db_query("UPDATE {comment_notify} cn INNER JOIN {comments} c ON cn.cid = c.cid SET cn.notify = 0 WHERE c.mail = '%s'", $email);
480 481 482 483 484 485 486 487 488 489
  }
  // Update the admin about the state of this comment notification subscription.
  if ($comments == 0) {
    drupal_set_message(t("There were no active comment notifications for that email."));
  }
  else {
    drupal_set_message(format_plural($comments, "Email unsubscribed from 1 comment notification.",
      "Email unsubscribed from @count comment notifications."));
  }
}
490

491 492 493
/*
 * Page callback for administrative settings form.
 */
494 495
function comment_notify_settings() {
  $form['comment_notify_settings'] = array();
496 497

  // Only perform comment_notify for certain node types (default, all)
498
  $enabled_types = variable_get('comment_notify_node_types', FALSE);
499
  $anonymous_problems = '';
500 501 502
  foreach (node_get_types('names') as $type => $name) {
    $checkboxes[$type] = check_plain($name);
    $default[] = $type;
503 504

    // If they don't have the ability to leave contact info, then we make a report
505
    if ($enabled_types[$type] && variable_get('comment_anonymous_'. $type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
506 507 508 509 510 511
      $account = user_load(array('uid' => 0));
      if (user_access('Subscribe to comments', $account)) {
        $anonymous_problems[] = l(t('@content-type', array('@content-type' => $name)), 'admin/content/node-type/'. $type);
      }
    }
  }
greggles's avatar
greggles committed
512

513 514
  if (!empty($anonymous_problems)) {
    drupal_set_message(t('Anonymous commenters have the permission to subscribe to comments but cannot leave their contact infromation on the following content types: !types.  You should either disable subscriptions on those types here, revoke the permission for anonymous users, or enable anonymous users to leave their contact information in the comment settings.', array('!types' => implode(', ', $anonymous_problems))));
515 516 517 518
  }

  $form['comment_notify_settings']['comment_notify_node_types'] = array(
    '#type' => 'checkboxes',
519
    '#title' => t('Content Types To Enable for Comment notify'),
520 521 522 523 524
    '#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.'),
  );

525 526 527 528 529 530 531 532
  $form['comment_notify_settings']['comment_notify_regged_checkbox'] = array(
    '#type' => 'checkbox',
    '#title' => t('Let registered users select notification on a node basis'),
    '#return_value' => 1,
    '#default_value' => variable_get('comment_notify_regged_checkbox', TRUE),
    '#description' => t('letting registered users select/unselect if they want to be notified. If this is disabled, this setting is propagated from their user profile, hence reducing and clutter and confusion')
  );

533 534 535 536 537 538 539 540 541 542 543 544
  $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')
    )
  );

545
  $form['comment_notify_settings']['comment_notify_default_anon_mailalert'] = array(
546 547
    '#type' => 'select',
    '#title' => t('Default state for the notification selection box for anonymous users.'),
548
    '#return_value' => 1,
549 550 551 552 553 554 555
    '#default_value' => variable_get('comment_notify_default_anon_mailalert', array(COMMENT_NOTIFY_NODE, COMMENT_NOTIFY_COMMENT)),
    '#description' => t('This flag presets the flag for the follow-up notification on the form that anon users will see when posting a 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')
    )
556 557 558 559
  );

  $form['comment_notify_settings']['comment_notify_default_mailtext'] = array(
    '#type' => 'textarea',
560
    '#title' => t('Default mail text for sending out notifications to commenters.'),
561 562
    '#description' => t(
      'You can use the following variables to be replaced:
563
      <ul>
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587
      <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
  );

588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616
  $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
  );

617
  return system_settings_form($form);
618
}