comment_notify.module 23.4 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
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');

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

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

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

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

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

40
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.
41

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

Thanks for your feedback,

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

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

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

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

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

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

84 85 86 87 88 89 90 91 92 93
  $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)));

94
  foreach ($options as $available) {
95 96 97
    $available_options[$available] = $total_options[$available];
  }

98
  // Add the checkbox for anonymous users and set the default based on admin settings.
99
  if ($user->uid == 0) {
100 101 102 103
    // If anonymous user's can't enter their e-mail don't tempt them with the checkbox
    if (empty($form['mail'])) {
      return;
    }
104
    $form['notify'] = array(
105
      '#type' => 'select',
106
      '#title' => t('Notify me of follow-up comments posted here'),
107
      '#default_value' => variable_get('comment_notify_default_anon_mailalert', COMMENT_NOTIFY_DISABLED),
108
      '#options' => $available_options,
109 110
    );
  }
111 112 113 114
  // Always show the checkbox for registered users.
  // If you want to hide this on your site see http://drupal.org/node/322482
  $form['notify'] = array(
    '#type' => 'select',
115
    '#title' => t('Notify me of follow-up comments posted here'),
116 117 118
    '#default_value' => !empty($user->comment_notify_mailalert) ? $user->comment_notify_mailalert : variable_get('comment_notify_default_regged_mailalert', COMMENT_NOTIFY_DISABLED),
    '#options' => $available_options,
  );
119
  // If this is an existing comment we set the default value based on their selection last time.
120
  if ($form['cid']['#value'] != '') {
121 122
    $notify = db_result(db_query("SELECT notify FROM {comment_notify} WHERE cid = %d", $form['cid']['#value']));
    $form['notify']['#default_value'] = $notify;
123 124
  }
}
125

126
/**
127
 * Implementation of hook_perm().
128 129
 */
function comment_notify_perm() {
130
  return array('administer comment notify', 'subscribe to comments');
131
}
132 133 134 135

/**
 * Implementation of hook_menu().
 */
136 137 138
function comment_notify_menu() {

  $items['admin/settings/comment_notify'] = array(
139
    'title' => 'Comment notify',
140 141 142
    'description' => 'Configure settings for e-mails about new comments.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('comment_notify_settings'),
143
    'access arguments' => array('administer comment notify'),
144
    'type' => MENU_NORMAL_ITEM,
145
  );
146
  $items['admin/settings/comment_notify/settings'] = array(
147 148 149 150
    'title' => 'Settings',
    'description' => 'Configure settings for e-mails about new comments.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('comment_notify_settings'),
151
    'access arguments' => array('administer comment notify'),
152 153
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
154

155 156 157 158 159 160
  $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'),
161
    'access arguments' => array('administer comment notify'),
162 163 164 165 166 167 168 169
    'type' => MENU_LOCAL_TASK,
  );
  $items['comment_notify'] = array(
    'title' => 'comment notify',
    'page callback' => 'comment_notify_page',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK
  );
170 171 172 173

  return $items;
}

174 175 176
/**
 * Page callback to allow users to unsubscribe simply by visiting the page.
 */
177 178 179
function comment_notify_page() {
  global $user;

180 181
  $op = $_POST['op'];
  $edit = $_POST['edit'];
182

183
  $page_content = ' ';
184 185 186 187 188 189 190
  if (empty($op)) {
    $op = arg(1);
  }
  $arg = arg(2);

  switch ($op) {
    case 'disable':
191
      $key = $arg;
192
      db_query("UPDATE {comment_notify} SET notify = 0 WHERE notify_hash = '%s'", $arg);
193 194 195

      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.');
196 197
      break;
    default;
198
      $title = t('Comment notify');
199 200
      break;
  }
201

202
  drupal_set_title($title);
203
  return $page_content;
204 205
}

206
/**
207
 * Implementation of hook_comment().
208 209 210 211
 */
function comment_notify_comment($comment, $op) {
  global $user;

212
  switch ($op) {
213
    case 'validate':
214 215
       // 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.
216 217 218 219
      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;
220
    case 'publish':
221
      // The real meat of the module.
222 223 224
      _comment_notify_mailalert($comment);
      break;
    case 'update':
225
      // In case they have changed their status, save it in the database.
226
      $sql = 'UPDATE {comment_notify} SET notify = %d WHERE cid = %d';
227
      db_query($sql, $comment['notify'], $comment['cid']);
228
      break;
229
    case 'insert':
230 231 232 233 234
      // If they subscribe and don't have a default let them know that it's possible to set one.
      if (empty($user->comment_notify_mailalert) && $comment['notify']) {
        drupal_set_message(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'))));
      }

235
      // For new comments, we first build up a string to be used as the identifier for the alert
236
      $mail = empty($comment['mail']) ? $user->mail : $comment['mail'];
237
      $notify_hash = drupal_get_token($mail . $comment['cid']);
238
      // And then save the data.
239
      db_query("INSERT INTO {comment_notify} (cid, notify, notify_hash) values (%d, %d, '%s')", $comment['cid'], $comment['notify'], $notify_hash);
240
      break;
241 242 243
    case 'delete':
      db_query("DELETE FROM {comment_notify} WHERE cid = %d", $comment->cid);
      break;
244 245 246 247 248 249 250 251 252
  }
}

/**
 * Implementation of hook_user().
 */
function comment_notify_user($type, &$edit, &$user, $category = NULL) {
  switch ($type) {
    case 'form':
253
      if ($category == 'account' && user_access('subscribe to comments', $user)) {
254 255
        $form = array();
        $form['comment_notify_settings'] = array(
256 257 258 259 260 261
          '#type' => 'fieldset',
          '#title' => t('Comment follow-up notification settings'),
          '#weight' => 4,
          '#collapsible' => TRUE
        );

262 263 264 265 266 267 268
        $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.')
        );

269
        $form['comment_notify_settings']['comment_notify_mailalert'] = array(
270
          '#type' => 'select',
271
          '#title' => t('Receive comment follow-up notification e-mails'),
272
          '#default_value' => isset($edit['comment_notify_mailalert']) ? $edit['comment_notify_mailalert'] : variable_get('comment_notify_default_registered_mailalert', COMMENT_NOTIFY_DISABLED),
273 274 275 276 277
          '#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')
          ),
278
          '#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.")
279
        );
280 281
        return $form;
      }
282

283 284 285 286
      break;
  }
}

287 288
/**
 * Private function to send the notifications.
greggles's avatar
greggles committed
289
 *
290 291 292
 * @param $comment
 *   The comment array as found in hook_comment $op = publish.
 */
293 294
function _comment_notify_mailalert($comment) {
  $comment = (object) $comment;
295
  global $language;
296
  global $base_url;
297
  global $user;
298

299
  $initial_language = $language;
300

301
  if (function_exists('locale')) {
302
    $languages = locale_language_list();
303 304 305
    $languages = $languages['name'];
  }

306 307 308 309
  $nid = $comment->nid;
  $cid = $comment->cid;
  $node = node_load($nid);
  if (!isset($comment->mail)) {
310
    $comment_account = user_load(array('name' => $comment->name));
311 312 313 314 315
    $comment_mail = $comment_account->mail;
  }
  else {
    $comment_mail = $comment->mail;
  }
316 317 318 319
  $sent_to = array();

  // Send to a subscribed author if they are not the current commenter
  $author = user_load(array('uid' => $node->uid));
320
  if (!empty($author->node_notify_mailalert) && $author->node_notify_mailalert == 1 && $user->mail != $author->mail) {
321 322 323 324
    // Get the author's language.
    $language = user_preferred_language($author);
    $message['subject'] = t('!site :: new comment for your post.', array('!site' => variable_get('site_name', 'drupal')));
    $message['body'] = t(
325 326
      variable_get('node_notify_default_mailtext', AUTHOR_MAILTEXT),
      array(
327 328 329
        '!commname' => $comment->name,
        '!commtext' => $comment->comment,
        '!commsubj' => $comment->subject,
330
        '!comment_url' => url('node/'. $nid, array('absolute' => TRUE, 'fragment' => 'comment-'. $cid)),
331 332 333 334 335 336 337
        '!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,
338
        '!uri_brief' => preg_replace('!^https?://!', '', $base_url),
339
        '!date' => format_date(time()),
340
        '!login_uri' => url('user', array('absolute' => TRUE)),
341
        '!edit_uri' => url('user/'. $alert->uid .'/edit', array('absolute' => TRUE))
342 343
      )
    );
344
    drupal_mail('comment_notify', 'comment_notify_mail', $author->mail, $language, $message);
345 346
    $sent_to[] = $author->mail;
  }
347

348
  //Get the list of commenters to notify
349
  $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
350
    FROM {comments} c INNER JOIN {comment_notify} cn on c.cid = cn.cid LEFT OUTER JOIN {users} u ON c.uid = u.uid
351
    WHERE nid = %d AND cn.notify > 0 AND c.status = 0 AND (u.status = 1 OR u.uid = 0)", $nid
352
  );
353
  // 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
354

355
  while ($alert = db_fetch_object($result)) {
356 357 358
    $umail = empty($alert->umail) ? $alert->uinit : $alert->umail;
    $mail = empty($alert->cmail) ? $umail : $alert->cmail;

359 360 361 362
    if ($alert->notify == COMMENT_NOTIFY_COMMENT && $alert->cid != $comment->pid) {
      break;
    }

363
    if ($mail != $comment_mail && !in_array($mail, $sent_to) && $alert->uid != $comment->uid) {
364 365
      $message = array();
      if (!empty($alert->uid)) {
greggles's avatar
greggles committed
366
        $recipient_user = user_load(array('uid' => $alert->uid));
367 368 369 370
        $language = user_preferred_language($recipient_user);
      }
      else {
        $language = language_default();
371
      }
372

373
      $message['subject'] = t('!site :: new comment for your post.', array('!site' => variable_get('site_name', 'drupal')));
374
      $message['body'] = t(
375 376
        variable_get('comment_notify_default_mailtext', DEFAULT_MAILTEXT),
        array(
377 378 379
          '!commname' => $comment->name,
          '!commtext' => $comment->comment,
          '!commsubj' => $comment->subject,
380
          '!comment_url' => url('node/'. $nid, array('absolute' => TRUE, 'fragment' => 'comment-'. $cid)),
381 382 383 384 385 386 387
          '!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,
388
          '!uri_brief' => preg_replace('!^https?://!', '', $base_url),
389
          '!date' => format_date(time()),
390 391
          '!login_uri' => url('user', array('absolute' => TRUE)),
          '!edit_uri' => url('user/'. $alert->uid .'/edit', array('absolute' => TRUE)),
392
          '!link1' => url('comment_notify/disable/'. $alert->notify_hash, array('absolute' => TRUE))
393
        )
394
      );
395
      drupal_mail('comment_notify', 'comment_notify_mail', $mail, $language, $message);
396
      $sent_to[] = $mail;
397

398
      // Make the mail link to user's /edit, unless it's an anonymous user.
399
      if ($alert->uid != 0) {
400
        $user_mail = l($mail, 'user/'. $alert->uid .'/edit');
401 402
      }
      else {
403
        $user_mail = check_plain($mail);
404
      }
405

406
      // Add an entry to the watchdog log.
407 408 409 410 411 412 413 414 415
      watchdog(
        'comment_notify',
        'Notified: !user_mail',
        array('!user_mail' => $user_mail),
        WATCHDOG_NOTICE,
        l(t('source comment'), 'node/'. $nid, array(
          'fragment' => 'comment-'. $alert->cid,
        ))
      );
416

417
      // revert to previous (site default) locale
418
      $language = $initial_language;
419 420 421 422
    }
  }
}

423 424
function comment_notify_mail($key, &$message, $params) {
  $message['subject'] = $params['subject'];
425
  $message['body'][] = $params['body'];
426 427 428
}


429
/**
430
 * Callback for an administrative form to unsubscribe users by e-mail address.
431 432 433 434 435 436 437 438 439 440 441 442 443
 */
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;
}
444

445
/**
446
 * Based on admin submit, do the actual unsubscribe from notifications.
447
 */
448 449
function comment_notify_unsubscribe_submit($form, &$form_state) {
  $email = trim($form_state['values']['email_to_unsubscribe']);
450
  // If they have a uid, use that, otherwise update comments directly
451
  $result = db_result(db_query_range("SELECT uid FROM {users} WHERE mail = '%s'", $email, 0, 1));
452
  if ($result > 0) {
453
    $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));
454
    db_query("UPDATE {comment_notify} SET notify = 0 WHERE cid IN (SELECT cid FROM  {comments} WHERE uid = %d)", $result);
455 456
  }
  else {
457
    $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));
458
    db_query("UPDATE {comment_notify} SET notify = 0 WHERE cid IN (SELECT cid FROM {comments} WHERE mail = '%s')", $email);
459 460 461 462 463 464 465 466 467 468
  }
  // 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."));
  }
}
469

470 471 472
/*
 * Page callback for administrative settings form.
 */
473 474
function comment_notify_settings() {
  $form['comment_notify_settings'] = array();
475 476

  // Only perform comment_notify for certain node types (default, all)
477
  $enabled_types = variable_get('comment_notify_node_types', FALSE);
478
  $anonymous_problems = '';
479 480 481
  foreach (node_get_types('names') as $type => $name) {
    $checkboxes[$type] = check_plain($name);
    $default[] = $type;
482 483

    // If they don't have the ability to leave contact info, then we make a report
greggles's avatar
greggles committed
484
    if (isset($enabled_types[$type]) && $enabled_types[$type] && variable_get('comment_anonymous_'. $type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) == COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
485
      $account = user_load(array('uid' => 0));
486
      if (user_access('subscribe to comments', $account)) {
487 488 489 490
        $anonymous_problems[] = l(t('@content-type', array('@content-type' => $name)), 'admin/content/node-type/'. $type);
      }
    }
  }
greggles's avatar
greggles committed
491

492 493
  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))));
494 495 496 497
  }

  $form['comment_notify_settings']['comment_notify_node_types'] = array(
    '#type' => 'checkboxes',
498
    '#title' => t('Content types to enable for comment notification'),
499 500 501 502 503
    '#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.'),
  );

504 505
  $form['comment_notify_settings']['comment_notify_available_alerts'] = array(
    '#type' => 'checkboxes',
506
    '#title' => t('Available subscription modes'),
507
    '#return_value' => 1,
508
    '#default_value' => variable_get('comment_notify_available_alerts', array(COMMENT_NOTIFY_NODE, COMMENT_NOTIFY_COMMENT)),
509
    '#description' => t('Choose which notification subscription styles are available for users'),
510 511 512 513 514 515
    '#options' => array(
      COMMENT_NOTIFY_NODE     => t('For all comments on a post'),
      COMMENT_NOTIFY_COMMENT  => t('Just for replies to a comment')
    )
  );

516 517 518 519 520 521
  $available_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')
    );

522
  $form['comment_notify_settings']['comment_notify_default_anon_mailalert'] = array(
523
    '#type' => 'select',
524
    '#title' => t('Default state for the notification selection box for anonymous users'),
525
    '#return_value' => 1,
526 527 528 529 530 531 532 533 534 535 536
    '#default_value' => variable_get('comment_notify_default_anon_mailalert', COMMENT_NOTIFY_NODE),
    '#options' => $available_options,
  );

  $form['comment_notify_settings']['comment_notify_default_registered_mailalert'] = array(
    '#type' => 'select',
    '#title' => t('Default state for the notification selection box for registered users.'),
    '#return_value' => 1,
    '#default_value' => variable_get('comment_notify_default_registered_mailalert', COMMENT_NOTIFY_NODE),
    '#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' => $available_options,
537 538
  );

539

540 541
  $form['comment_notify_settings']['comment_notify_default_mailtext'] = array(
    '#type' => 'textarea',
542
    '#title' => t('Default mail text for sending out notifications to commenters'),
543 544
    '#description' => t(
      'You can use the following variables to be replaced:
545
      <ul>
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
      <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
  );

570 571
  $form['comment_notify_settings']['node_notify_default_mailtext'] = array(
    '#type' => 'textarea',
572
    '#title' => t('Default mail text for sending out the notifications to node authors'),
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
    '#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
  );

599
  return system_settings_form($form);
600
}