as a followup to
adding settings to notify users on account status changes →
, and to potentially pave the way for
email users upon change of role →
, i've been thinking more about this UI. what if an admin both approves a user and puts them in some new roles? they shouldn't get 2 different emails. instead of different settings for each possible change to the status, we only need 4 template settings:
- user created by admin
- user registered herself, no approval required
- user registered herself, pending approval
- user account changed
there would be additional admin settings that defined template paragraphs that could be conditionally loaded into any of (therefore shared among) these overall message templates. for example, there might be the following paragraphs defined:
- !p_active
- !p_deleted
- !p_blocked
- !p_roles_added
- !p_roles_removed
- !p_temp_login
each token would have a value if the changed happened, or would be removed if the status didn't match or there was no change of roles, etc. if a new 1-time login link was made, !p_temp_login would be a paragraph that describes how to use the login link. !p_temp_login could be shared among the password reset, account approved by admin, and new account registration messages, for example...
to define each of these paragraphs, you'd have access to specific tokens. in addition to the existing tokens, there might be others like:
then, the default value of the "user account changed" message body would be something like:
!username,
!p_active
!p_temp_login
!p_roles_added
!p_roles_removed
!p_blocked
-- !site team
that way, if an admin approves an account and adds some roles, the user gets 1 email that might look something like:
dww,
Your account at baterialucha.org is now active.
You may now log in by clicking on this link or copying and pasting it in your browser:
!login_url
This is a one-time login, so it can be used only once. After logging in, you will be redirected to !edit_uri so you can change your password.
This site has different kinds of users based on the roles they play, with varying levels of permission and access. You have been added to the following user roles: band member, organizer, administrator.
the template for accounts created by the admin would be something like:
<code>
!username,
An administrator has created an account for you at !site.
!p_temp_login
!p_roles_added
-- !site team
if the site doesn't care about separately worded paragraphs for each possible status change, they could just use this for the start of their "user account changed" message body:
!username,
Your account at !site is now !current_status.
...
open questions:
- maybe we want to keep the password reset as its own message template, so you can customize the introduction before the !p_temp_login, or perhaps we just need another conditional account change token like !p_password_reset_requested.
- are we going to get screwed with tokens inside of tokens? seems like we're going to have pass the message templates through the token translation recursively, until no more tokens are matched and replaced. or, perhaps we want different symbols at the front of the different kinds of tokens, and they get replaced in a fixed order? that seems more ugly and inflexible to me.
- do people think this is too confusing and complicated a UI for end-user admins to grasp and configured properly?
- should we provide a UI for site admins to define their own new paragraph tokens if they wanted to insert
shared text into all of the messages? (a shared site-specific signature, for example)