powerful email message template UI: tokens within tokens

Created on 23 May 2007, about 18 years ago
Updated 18 June 2023, about 2 years ago

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:

  1. user created by admin
  2. user registered herself, no approval required
  3. user registered herself, pending approval
  4. 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:

  1. 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.
  2. 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.
  3. do people think this is too confusing and complicated a UI for end-user admins to grasp and configured properly?
  4. 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)
Feature request
Status

Postponed: needs info

Version

9.5

Component
User system 

Last updated 4 days ago

Created by

🇺🇸United States dww

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024