Problem/Motivation
User mail notifications are triggered differently:
'register_*'
e-mails are triggered by the form creating the user,'status_activated'
, and'status_blocked'
e-mail are triggered by the User Entity itself inUser::postSave
.
Beyond being obscurely inconsistent:
You need to choose to also trigger a mail in code when you programatically create an active user; but you always get a mail trigger when you change the status
[At least not without changing the configuration user_settings:status_*
values]
It also means you can't programatically and silently change the status of an existing user, unlike creating a new active user; and it means you couldn't add the option to not notify the user on an admin form.
Proposed resolution
Move the trigger out of User::postSave
and put it on forms, actions, as appropriate.
Or add some other switch to make it easier not to trigger the mail.
Remaining tasks
Decide which to do.
Do it.
User interface changes
None, but facilitates making optional notification should someone want to do it in contrib.
API changes
The first option (moving out of postSave) would require parties relying on API to add notification to their code.
Data model changes
None.
Comments