You can use tokens in the welcome emails available at admin/config/people/accounts/settings

Hoewever, when a token is empty it will be rendered as the actual token replacement string in the email.

For example:

Dear [user:field_firstname] [user:field_preposition] [user:field_lastname],

becomes this in the email:

Dear John [user:field_preposition] Doe,

This is because user.module does not use the "clear" option for the token_replace function as described here:
http://drupal.org/node/1272028

The patch attached adds this option to the function in user.module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, token_replace_user_module.patch, failed testing.

Dave Reid’s picture

Version: 7.8 » 8.x-dev
Issue tags: +token

Bugs have to be fixed in 8.x first, then backported to 7.x. I approve of this change, we just need a patch rolled with the correct format.

askibinski’s picture

Status: Needs work » Needs review
FileSize
725 bytes

Here is a patch against 8.x according to the patch guidelines. Should be okay...

attiks’s picture

Status: Needs review » Needs work
+++ b/modules/user/user.moduleundefined
@@ -2691,7 +2691,7 @@ Your account on [site:name] has been canceled.
     // We do not sanitize the token replacement, since the output of this

Comment says not to sanitize, but your code has 'sanitize' => TRUE, used to be FALSE, why the need to change it?

-10 days to next Drupal core point release.

askibinski’s picture

Status: Needs work » Needs review
FileSize
726 bytes

Woops.... how did that get in there... sorry. Here is a reroll!

attiks’s picture

Look better ;p

askibinski’s picture

Rerolled the patch for the new core directory structure.

mariagwyn’s picture

Does this need to be tested? I need this since I just discovered this problem and need to send a whole slew of emails to users who are about to be activated. I am rather hesitant to apply a patch to a core module on my site....

peterx’s picture

#7 works in D7.9 if you replace line 2742 instead of 2709.

Jelle_S’s picture

Status: Needs review » Reviewed & tested by the community

Works in D8

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x and 8.x. Thanks!

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