Problem/Motivation

When a user signup on the platform from a course (e.g. by requesting to join a course), a destination URL is appended to the one-time-login link sent in the email. It's currently done in \Drupal\social_course\SocialCourseOverrides by overriding the config user.mail and replacing the [user:one-time-login-url] string by [user:one-time-login-url][user:destination-url], which contains the destination URL.

However, since the original config value is being assigned directly to the mail body, the messages are always sent in the original language, even though there is a config translation available.

Proposed resolution

Since overriding a configuration is not always a good idea, given that it makes hard to maintain and debug, the proposed solution is to properly replace the token [user:one-time-login-url] in a hook_mail_alter(), so it will always return the proper content according to the user's language.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tregismoreira created an issue. See original summary.

tregismoreira’s picture

Issue summary: View changes
tregismoreira’s picture

Version: 5.2.1 » 5.1.4
tregismoreira’s picture

Title: Properly replace email tokens to avoid conflict with config translations » Properly replace email tokens to avoid issues with config translations

tregismoreira’s picture

Title: Properly replace email tokens to avoid issues with config translations » Properly replace token [user:one-time-login-url] to avoid issues with config translations

  • tregismoreira committed f278d709 on 5.1.x
    Issue #3438712: Properly replace token `[user:one-time-login-url]` to...

  • ribel committed 40d6729f on 5.2.x authored by tregismoreira
    Issue #3438712: Properly replace token `[user:one-time-login-url]` to...
ribel’s picture

Version: 5.1.4 » 5.2.3
Category: Feature request » Bug report
Status: Active » Fixed

Fix was tested, merged and released in version 5.2.3

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.