Problem/Motivation

I have installed Notify on a fresh install of D9 (9.2)
I have added 1 content type additional to Article and Basic page and 1 webform.

I have set Notification default for new users
yes Receive e-mail notifications
The default master switch for new users (check for enabled, uncheck for disabled).

I have set the default for NOTIFICATION BY NODE TYPE and saved the form:
Notification by node type
Node types
yes Article
yes Fungus (new content type)
no Basic page
no Webform (new webform)

I have set Initial settings as and saved the form:
Notify new content
Enabled
Include new posts in the notification mail.
Notify new comments
Enabled
Include new comments in the notification mail.
How much to include?
Title only

Issue 1:
/user//notify
For any logged in user, under "Notify Settings":
All 4 entity types are displayed, all entity types are checked yes, default settings are ignored

Issue 2:
/user//notify
For any logged in user, under "Notify Settings":
All notification settings are disabled, default settings are ignored

This is not a production environment so I have not tested sending of notiications.

It appears that all defaults are ignored.

How to resolve this?

Thanks :)

Steps to reproduce

Set defaults at admin/config/people/notify/defaults

Log in as any user.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

CBEEM created an issue. See original summary.

cbeem’s picture

I have inherited a D7 site with 38 content types and thousands of users. The original D7 site depends heavily on Notify.

In D9 all content types display on the user "Notify settings" page regardless of defaults which is impractical in this case.

I have temporarily solved this issue by manually entering a limiting array for 3 of the 38 content types ($list = array("article", "event", "pinboard");).

usersettings.php line 182:

if (\Drupal::currentUser()->hasPermission('administer notify queue') || empty($enatypes )) {
$enatypes = [];
$list = array("article", "event", "pinboard");
foreach ($alltypes as $type => $obj) {
if (in_array($type, $list)) {
$enatypes[] = [$type, $obj->label()];
//print_r(array_values($enatypes));
}
}
}

Seems to be working OK but it is a temporary patch.

Note that no users other than admin have 'administer notify queue' permission, but this is the only place where I can get this override to work.

Nice module, I look forward to a more professional fix at some stage.

Thx

gisle’s picture

Issue tags: -node, -list, -default value

Removed spurious tags, please see https://www.drupal.org/node/3156530

  • gisle authored 2fbac89 on 2.0.x
    Issue #3219437 by gisle: Fixed preferences ignored for all users.
    
gisle’s picture

Status: Active » Needs review

I've corrected it and pushed the change to the latest 2.0.x-dev snapshot. Please review.

cbeem’s picture

Thanks, I removed notify and replaced with the new dev.

I selected 5 content types as default.

Sorry, no, there is still a crazy list of 38 content types displayed for all users, the defaults are being ignored.

The behavior in D7 was that only content types selected in the the default settings were displayed to users.

So at this stage I will say no, this has not fixed my problem.

Thx

gisle’s picture

Status: Needs review » Postponed (maintainer needs more info)

Sorry, no, there is still a crazy list of 38 content types displayed for all users, the defaults are being ignored.

The behavior in D7 was that only content types selected in the the default settings were displayed to users.

Are all 38 content types selected for all users, or are only the defaults selected?

The code has been extensibly rewritten since the D7 version, including how defaults are handled.

A screenshot of how the the D8/9 version looks compared to the D7 version may also be helpful..

cbeem’s picture

Only the defaults are selected, which is great.
So now the user registration page is working and also the defaults are all selected correctly for a new user.

The only differences left between D7 and D9 are these:

In D7 for all users other than administrators only the default content types are displayed to the user (e.g. 5/38)
In D7 for administrators the full 38 content types are displayed to the user.

In D9 in both cases all 38 content types are displayed to the user.

In D7 the check boxes for How much to include? all function:
How much to include?
Title only
Title + Teaser/Excerpt
Title + Body
Title + Body + Fields

In D9 only the title is delivered by email, regardless of the user selection.
Personally I don't want the other selections so I have disabled them in my case so they do not display to the user.
However I have to run through the database and change all users to "Title only" otherwise the user sees an "illegal selection" message if they don't manually recheck the title option.

Thanks :)

gisle’s picture

Title: Default node notification preferences ignored for all users » Not permitted subscriptions are shown to non-admin users
Assigned: Unassigned » gisle
Status: Postponed (maintainer needs more info) » Needs work

From comment #8, I gather that the problem now is that subscriptions that are not permitted (as set by the Notify admin on the Notify Default Settings page) are shown as available to non-admin users. Updating the issue's Title to reflect that.

As for the issue with "How much to include?", please see separate issue #3221733: Remove "How much to send?" settings.

  • gisle authored 73bfeca on 2.0.x
    Issue #3219437 by gisle: Fixed non-permitted subscriptions are shown for...
gisle’s picture

Assigned: gisle » Unassigned
Status: Needs work » Needs review

I've corrected it and pushed the change to the latest 2.0.x-dev snapshot. Please review.

cbeem’s picture

That is working, thank you! Awesome. I can remove my custom code now.
Admins no longer get a list of all content types, but I can live with that, it is not necessary in my case.

Thank you, very happy :)

gisle’s picture

Status: Needs review » Fixed

Fixed, based upon #12.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.