Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal email variables not appearing

Whenever a user registers an account, the automated emails (which I can set in admin/config/people/accounts) are not carrying over the defined variables for username, email, etc.

For example. Here's what I have set for one email:

[user:name],

Thank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another e-mail containing information about how to log in, set your password, and other details.

-- [site:name] team

Those variables in brackets just aren't appearing. The email sends as usual, but where those variables are, nothing gets inserted. Is there something I have to enable first?

like image 972
Mark Lyons Avatar asked May 11 '13 19:05

Mark Lyons


1 Answers

The token replacement in mails happen in line 2815 of user.module (modules/user/user.module). You can add the following line of code

drupal_set_message("Text: $text, Variables: " . print_r($variables, TRUE) . ", Language: $language);

before the line that says

return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));

That will tell you as messages what is happening with the token replacement issue. If you can post the messages that you see back here I can help solve the issue.

like image 96
anoopjohn Avatar answered Oct 28 '22 07:10

anoopjohn