--- modules/system/system.module.orig 2008-07-09 17:48:28.000000000 -0400 +++ modules/system/system.module 2008-07-25 16:57:55.000000000 -0400 @@ -1612,7 +1612,7 @@ function system_send_email_action_form($ '#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; } @@ -1702,6 +1702,11 @@ function system_send_email_action($objec $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)); } @@ -1745,6 +1750,25 @@ function system_mail($key, &$message, $p '%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);