Right now, PM Email Notify assumes a given user wants the default setting if there is no entry for them in the pm_email_notify table. Specifically, it is my understanding (please correct me if I'm wrong) that the module only saves a given user's setting to the pm_email_notify table if that user changes his preference away from the default preference established by the site administrator at admin/settings/messsages/notify.
I think this is a problem. Imagine the following situation:
1. A new site launches, with the "Notify users of new private messages by default" check box marked checked on at admin/settings/messages/notify. So, when users register they will by default receive email notifications unless they change their preference on their account edit page.
2. 5 users register, and because they want email notifications, they do not modify this preference on their account page. So, no entry is made for them in the pm_email_notify table
3. One month later, the administrator decides that the default should be that users do not receive notifications, and he switches off the checkbox at admin/settings/messages/notify
4. All of a sudden, the 5 users who registered prior to the change in the default will stop receiving email notifications, even though they have not gone in and changed their preference on their account edit page.
This will be very confusing and annoying to the 5 users, who expect that once their preference is set it is not going to change unless they change it themselves.
To avoid this, I think an entry should be made in the pm_email_notify table for every user. If the setting is not on the registration form, then the table entry will be set to the default value. If the setting is on the user registration form, then the table entry will be set to the value indicated by the user during registration.
This would make it so that if an admin changes the default setting, it only affects new registrations. All users registered prior to the change would retain their setting.
Comments
Comment #1
berdirUhm, not sure, but I think this is the behavior for all default settings for most if not all Drupal modules. The same happens if the default value of any setting that is handled with variable_get/set is changed by a module developer.
I would say this is a won't fix... :)
Comment #2
litwol commented@sja1, Can you run a quick base install and test whether this behavior indeed as you speculate?
This is certainly an unexpected and by much an unwanted behavior. User settings for existing users should persist after they've received them.
As an extening thought: Perhaps we need to offer admin email notification UI to perform full wipe/reset of current user base settings. for example: you can reset your whole email notify user preference to be all for 'do not notify' or 'do notify' while setting all future default to something else.
Overall this feature is very easy, but lets discuss if it make sense to exist.
Comment #3
sja1 commentedTested, and it does behave that way. To replicate:
1. Set admin default setting to off
2. Register a new user.
3. Login as that user, and visit the user's account edit page.
4. You will see that the option is set to off. Do not make any changes to the account, and do not hit save.
5. log off the new user, and log in as admin user
6. Change the default setting to on.
7. Log off as admin, and log in as the new user
8. Visit the new users account edit page, and you will see that the setting is now on.
9. Make a change to some part of the new users account (for example, change the password), but do not change the pm email setting. Hit the save button, and log off
10. Log back in as admin, and change the default back to off again.
11. Log out as admin, log in as new user and visit account edit page.
12. You will see that the pm email setting is still set to on.
So, it appears that the users setting will change each time the admin changes the default setting, up until they modify their account for the first time. Viewing their account edit page is not enough to lock the setting in place for them.
Comment #4
sja1 commentedupdating status
Comment #5
naheemsays commentedIs that not how it should be? if the user changes its settings, the settings are saved and override the defaults.
If the user on the other hand does not register any preference (and does not edit the profile for any other reason), then whatever the site default is changed to becomes what the user gets.