How to add and use custom email templates

Overview

Ultimate Member allows you to add custom email templates and edit them according to your needs. This feature is useful for creating personalized communication with your users. You can add custom email templates using the um_email_notifications hook and send emails based on these templates using the UM()->mail()->send( $email, $template, $args ); method.Optional argument $args allows to extend placeholders array. It is recommended to use a child theme for adding custom code to avoid losing your changes during theme upgrades.

How to Add a Custom Email Template

  1. Use the um_email_notifications hook to add custom templates. See the code examples below.
  2. Use the UM()->mail()->send( $email, $template, $args ); method to send emails based on the template. The optional $args argument allows you to extend the placeholder array.
  3. Add your custom code to the functions.php file in your active theme directory. Using a child theme is recommended.

How to Edit a Custom Email Template

Custom emails are displayed on the WordPress admin dashboard under wp-admin>Ultimate Member > Settings > Email. Administrators can edit custom email templates in the same way as default email templates.

Code Examples

Example 1 - Profile is Complete: This code adds the custom email template "Profile Completeness - Profile is complete" to be used with the Profile Completeness extension.

Example 2 - Account is Not Verified: This code adds the custom email template "Verified Users - Account is not verified E-mail" to be used with the Verified Users extension.

NOTE: We are not able to provide any support when it comes to customizing the plugin. We created this code example to provide guidance only.

Warning: We highly recommend to use child-theme for public free or pro themes. Do not edit template files within the core plugin itself, as they are overwritten during the upgrade process and any customizations will be lost. We recommend using a child-theme, which has no dependencies with the official themes repo, so your custom files cannot be rewritten after a theme upgrade.