Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.613 diff -u -r1.613 system.module --- modules/system/system.module 21 Aug 2008 19:36:38 -0000 1.613 +++ modules/system/system.module 26 Aug 2008 10:45:51 -0000 @@ -1777,7 +1777,7 @@ '#default_value' => $context['message'], '#cols' => '80', '#rows' => '20', - '#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'), + '#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body, %comment_subject, %comment_body, %comment_delete_url, %comment_edit_url, %comment_username. Not all variables will be available in all contexts.'), ); return $form; } @@ -1867,6 +1867,11 @@ $params['node'] = $node; } + // Include comment info if this is a comment. + if (isset($comment)) { + $params['comment'] = $comment; + } + if (drupal_mail('system', 'action_send_email', $recipient, $language, $params)) { watchdog('action', 'Sent email to %recipient', array('%recipient' => $recipient)); } @@ -1910,6 +1915,22 @@ '%body' => $node->body, ); } + + // Comment-based variables are available if we have a comment. + if (isset($params['comment'])) { + $comment = $params['comment']; + $variables += array( + '%comment_subject' => $comment->subject, + '%comment_body' => $comment->comment, + '%comment_username' => $comment->name, + '%comment_delete_url' => url('comment/delete/'.$comment->cid, array('absolute'=>TRUE)), + '%comment_edit_url' => url('comment/edit/'.$comment->cid, array('absolute'=>TRUE)), + ); + } + while (list($key,$val) = each($comment)) { + error_log("COMMENT $key = $val"); + } + $subject = strtr($context['subject'], $variables); $body = strtr($context['message'], $variables); $message['subject'] .= str_replace(array("\r", "\n"), '', $subject);