The best way to customise add and unsubscribe membership notification emailss

Created on 14 April 2025, 11 days ago

Problem/Motivation

The opigno_learning_path module send out notification to members that are added to or removed from a training

Request

I'd like to customise both notifications, especially adding the name and link of the course a member has been added to. Any suggestions would be appreciated, thanks.

๐Ÿ’ฌ Support request
Status

Active

Version

3.2

Component

Documentation

Created by

๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand philben

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

Comments & Activities

  • Issue created by @philben
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand philben
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand philben
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States pixiekat

    We use hook_mail_alter to alter the message (or disable it from being sent out all together).

    Target which message you want to alter with $message['key'] and then edit $message['body'][].

    You can get the group with \Drupal::routeMatch()->getParameter('group');.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand philben

    Thanks @Pixiecat.
    The hook_mail_alter is a good way to handle it. My only issue is that it doesnโ€™t work consistently; sometimes the default message goes through without the alter. Do you know what could be the issue? Iโ€™m filtering the messages by key before altering.

Production build 0.71.5 2024