### Eclipse Workspace Patch 1.0
#P comment_notify6
Index: comment_notify.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_notify/comment_notify.module,v
retrieving revision 1.37
diff -u -r1.37 comment_notify.module
--- comment_notify.module 26 Oct 2008 23:24:47 -0000 1.37
+++ comment_notify.module 28 Oct 2008 01:52:32 -0000
@@ -7,7 +7,6 @@
* This module provides comment follow-up e-mail notification for anonymous and registered users.
*/
-
define('AUTHOR_MAILTEXT',
'Hi !name,
@@ -139,7 +138,6 @@
'#title' => t('Notify me of follow-up comments posted here.'),
'#default_value' => !empty($user->comment_notify_mailalert) ? $user->comment_notify_mailalert : variable_get('comment_notify_default_anon_maila\
lert', FALSE),
- '#description' => t('You can change the default for this field in "Comment follow-up notification settings" on your account edit page.', array('!uri' => url('user/'. $user->uid .'/edit'))),
'#options' => $available_options,
);
}
@@ -186,7 +184,7 @@
'access arguments' => array('administer comment notify'),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
-
+
$items['admin/settings/comment_notify/unsubscribe'] = array(
'title' => 'Unsubscribe',
'description' => 'Unsubscribe an email from all notifications.',
@@ -262,6 +260,11 @@
db_query($sql, $comment['notify'], $comment['cid']);
break;
case 'insert':
+ // If they subscribe and don't have a default let them know that it's possible to set one.
+ if (empty($user->comment_notify_mailalert) && $comment['notify']) {
+ drupal_set_message(t('You can change the default for this field in "Comment follow-up notification settings" on your account edit page.', array('!uri' => url('user/'. $user->uid .'/edit'))));
+ }
+
// For new comments, we first build up a string to be used as the identifier for the alert
$mail = empty($comment['mail']) ? $user->mail : $comment['mail'];
$notify_hash = drupal_get_token($mail . $comment['cid']);
@@ -347,7 +350,7 @@
// Send to a subscribed author if they are not the current commenter
$author = user_load(array('uid' => $node->uid));
- if ($author->node_notify_mailalert == 1 && $user->mail != $author->mail) {
+ if (!empty($author->node_notify_mailalert) && $author->node_notify_mailalert == 1 && $user->mail != $author->mail) {
// Get the author's language.
$language = user_preferred_language($author);
$message['subject'] = t('!site :: new comment for your post.', array('!site' => variable_get('site_name', 'drupal')));
@@ -374,7 +377,7 @@
drupal_mail('comment_notify', 'comment_notify_mail', $author->mail, $language, $message);
$sent_to[] = $author->mail;
}
-
+
//Get the list of commenters to notify
$result = db_query("SELECT DISTINCT c.cid, c.uid, c.name, c.nid, c.mail AS cmail, u.mail AS umail, u.init AS uinit, c.uid, c.name, cn.notify, cn.notify_hash
FROM {comments} c INNER JOIN {comment_notify} cn on c.cid = cn.cid LEFT OUTER JOIN {users} u ON c.uid = u.uid