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.
Comments
Comment #2
cbeem commentedI 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
Comment #3
gisleRemoved spurious tags, please see https://www.drupal.org/node/3156530
Comment #5
gisleI've corrected it and pushed the change to the latest 2.0.x-dev snapshot. Please review.
Comment #6
cbeem commentedThanks, 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
Comment #7
gisleAre 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..
Comment #8
cbeem commentedOnly 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 :)
Comment #9
gisleFrom 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.
Comment #11
gisleI've corrected it and pushed the change to the latest 2.0.x-dev snapshot. Please review.
Comment #12
cbeem commentedThat 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 :)
Comment #13
gisleFixed, based upon #12.