I have configured the default settings for comment notify by ticking all three checkboxes and setting the defaults for both anonymous and authenticated to "All comments".

Then I created a test user, but their comment follow up defaults to "no notifications". Shouldn't thiss be "All comments"?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tsvenson’s picture

Priority: Normal » Major

Have just tested this with the latest dev version and it still isn't giving new users the correct default setting. The still get "no notifications" even though "All comments" should be the default value.

omnyx’s picture

I've been noticing this as well, and while it's a bug, the module is still 'functioning', i.e. no error messages :)

codeforkjeff’s picture

FileSize
611 bytes

I'm using the feb 25 dev version. For me, this bug only shows up for anonymous users. Registered users get default settings applied correctly to the form.

Attached is a patch to make the comment form pick up the correct default for anonymous users.

tsvenson’s picture

tsvenson’s picture

@codeforkjeff: Strange, its the total opposite for me on all sites I use this module on. Anonymous users does get notifications, but new users does not get the default setting corrct resulting in that they don't get any notifications.

berenddeboer’s picture

Status: Active » Needs review
FileSize
4.04 KB

Lots of code missing, so basically doesn't work at all. Here the patch against dev.

berenddeboer’s picture

If you signup a new user, the node notify will always be false. I think that's wrong, it should be the default setting. Here my proposed patch for comment_notify_form_alter():

-      '#value' => COMMENT_NOTIFY_DISABLED,
+      '#value' => $user->uid ? COMMENT_NOTIFY_DISABLED : comment_notify_variable_registry_get('node_notify_default_mailalert'),
tsvenson’s picture

@berenddeboer Nice one. Do I need to apply both the patch in #6 and the code snippet in #7?

berenddeboer’s picture

FileSize
7.46 KB

Yes.

Put some time into combining all my changes into a single patch against dev, hopefully the maintainer can apply this ASAP.

Changes:
1. Properly sanitize comments, so mime mail gets them fine.

2. Properly store notification settings when creating/editing users.

3. For anonymous users, set default node creation to default setting (as they are not created, we can't check if they have permissions to create anything).

Dave Reid’s picture

+++ comment_notify/comment_notify.module	(working copy)
@@ -317,8 +318,8 @@
-  foreach (node_type_get_names() as $type => $name) {
-    if (node_access('create', $type)) {
+  foreach (node_type_get_names() as $type => $description) {
+    if (user_access('create ' . $type . ' content')) {

What's the reason for this change? Using node_access() is the proper way to check this because this will fail on blog content types.

Powered by Dreditor.

berenddeboer’s picture

FileSize
7.46 KB

Ah, my mistake. That's because I worked with the 1.0-alpha version (which had that) and bits have been inadvertedly copied over.

Rerolled patch.

greggles’s picture

Status: Needs review » Needs work

This no longer applies:

greggles@biff:~/workspace/d7/sites/all/modules/comment_notify$ patch -p1 < comment_notify_full_0.patch 
patching file comment_notify.inc
patching file comment_notify.module
Hunk #2 succeeded at 294 (offset -5 lines).
Hunk #3 succeeded at 313 (offset -5 lines).
Hunk #4 succeeded at 331 (offset -5 lines).
Hunk #5 succeeded at 340 (offset -5 lines).
Hunk #6 succeeded at 348 (offset -5 lines).
Hunk #7 succeeded at 378 (offset -5 lines).
Hunk #8 succeeded at 413 (offset -5 lines).
Hunk #9 succeeded at 424 (offset -5 lines).
Hunk #10 succeeded at 439 (offset -5 lines).
Hunk #11 FAILED at 457.
Hunk #12 FAILED at 465.
Hunk #13 FAILED at 510.
Hunk #14 succeeded at 518 (offset -9 lines).
Hunk #15 succeeded at 711 with fuzz 1 (offset 14 lines).
3 out of 15 hunks FAILED -- saving rejects to file comment_notify.module.rej
greggles@biff:~/workspace/d7/sites/all/modules/comment_notify$ 

Can you re-roll?

tsvenson’s picture

Would be great with a reroll for the latest dev/beta thanks.

greggles’s picture

Title: New users does not get default state settings » New users do not get default state settings
if (node_access('create ' . $type . ' content')) {

That's just wrong. It should not have been modified. The most recent patch needs more than a re-roll it needs a fine-review. It has a lot of changes that are not appropriate.

comment_notify_user_insert needs a docblock.

greggles’s picture

Status: Needs work » Closed (duplicate)

I think the only problem specific to this issue that was remaining here was fixed in #1234818: comment notifications turned off for new users by default: variable misnamed.