Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.585.2.21 diff -u -p -r1.585.2.21 system.module --- modules/system/system.module 8 Oct 2008 20:47:04 -0000 1.585.2.21 +++ modules/system/system.module 19 Oct 2008 07:47:49 -0000 @@ -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,.%term_name, %term_description, %term_id, %vocabulary_name, %vocabulary_description, %vocabulary_id. 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,18 @@ 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)), + ); + } $subject = strtr($context['subject'], $variables); $body = strtr($context['message'], $variables); $message['subject'] .= str_replace(array("\r", "\n"), '', $subject); @@ -1758,7 +1775,7 @@ function system_message_action_form($con '#default_value' => isset($context['message']) ? $context['message'] : '', '#required' => TRUE, '#rows' => '8', - '#description' => t('The message to be displayed to the current user. 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 to be displayed to the current user. 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,.%term_name, %term_description, %term_id, %vocabulary_name, %vocabulary_description, %vocabulary_id. Not all variables will be available in all contexts.'), ); return $form; } @@ -1820,6 +1837,16 @@ function system_message_action(&$object, ) ); } + // Comment-based variables are available if we have a comment. + if (isset($comment)) { + $variables += array( + '%comment_subject' => filter_xss($comment->subject), + '%comment_body' => filter_xss($comment->comment), + '%comment_username' => check_plain($comment->name), + '%comment_delete_url' => url('comment/delete/'.$comment->cid, array('absolute'=>TRUE)), + '%comment_edit_url' => url('comment/edit/'.$comment->cid, array('absolute'=>TRUE)), + ); + } $context['message'] = strtr($context['message'], $variables); drupal_set_message($context['message']); }