diff --git a/comment_notify/comment_notify.module b/comment_notify/comment_notify.module index 01a3330..b780c3d 100644 --- a/comment_notify/comment_notify.module +++ b/comment_notify/comment_notify.module @@ -397,9 +397,11 @@ function _comment_notify_mailalert($comment) { if (empty($enabled_types[$node->type])) { return; } + + // Load the user object for the comment account. + $comment_account = user_load(array('name' => $comment->name)); if (!isset($comment->mail)) { - $comment_account = user_load(array('name' => $comment->name)); $comment_mail = $comment_account->mail; } else { @@ -418,7 +420,7 @@ function _comment_notify_mailalert($comment) { variable_get('node_notify_default_mailtext', AUTHOR_MAILTEXT), array( '!cid' => $cid, - '!commname' => $comment->name, + '!commname' => strip_tags(theme('username', $comment_account)), '!commtext' => drupal_html_to_text($comment_text), '!commsubj' => $comment->subject, '!comment_url' => url('node/'. $nid, array('absolute' => TRUE, 'fragment' => 'comment-'. $cid)), @@ -427,7 +429,7 @@ function _comment_notify_mailalert($comment) { '!mission' => variable_get('site_mission', ''), '!nid' => $nid, '!node_body' => drupal_html_to_text($node_body), - '!name' => $author->name, + '!name' => strip_tags(theme('username', $author)), '!site' => variable_get('site_name', 'drupal'), '!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url), @@ -478,7 +480,7 @@ function _comment_notify_mailalert($comment) { variable_get('comment_notify_default_mailtext', DEFAULT_MAILTEXT), array( '!cid' => $cid, - '!commname' => $comment->name, + '!commname' => strip_tags(theme('username', $comment_account)), '!commtext' => drupal_html_to_text($comment_text), '!commsubj' => $comment->subject, '!comment_url' => url('node/'. $nid, array('absolute' => TRUE, 'fragment' => 'comment-'. $cid)), @@ -487,7 +489,7 @@ function _comment_notify_mailalert($comment) { '!mission' => variable_get('site_mission', ''), '!nid' => $nid, '!node_body' => drupal_html_to_text($node_body), - '!name' => $alert->name, + '!name' => strip_tags(theme('username', $alert)), '!site' => variable_get('site_name', 'drupal'), '!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url),