Commit b1a8cf31 authored by greggles's avatar greggles

Issue #1576878 by greggles: Don't send email to anonymous node's author

parent 7b915839
......@@ -461,10 +461,12 @@ function _comment_notify_mailalert($comment) {
}
$sent_to = array();
// Send to a subscribed author if they are not the current commenter
// Send to a subscribed author if they are not the current commenter.
$author = user_load($node->uid);
if (((!empty($author->comment_notify_settings->node_notify) && $author->comment_notify_settings->node_notify == 1) || (comment_notify_variable_registry_get('node_notify_default_mailalert') == 1 && empty($author->comment_notify_settings->node_notify))) && $user->uid != $author->uid && node_access('view', $node, $author)) {
// Do they explicitly want this? Or is it default to send to users?
// Is the comment author not the node author? Do they have access? Do they have an email (e.g. anonymous)?
if (((!empty($author->comment_notify_settings->node_notify) && $author->comment_notify_settings->node_notify == 1) || (comment_notify_variable_registry_get('node_notify_default_mailalert') == 1 && empty($author->comment_notify_settings->node_notify))) && $user->uid != $author->uid && node_access('view', $node, $author) && !empty($author->mail)) {
// Get the author's language.
$language = user_preferred_language($author);
$raw_values = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment