Currently, its not possible to override the default values for the user_mail variables. These get pulled directly from the _user_mail_text function.

Comments

mrfelton’s picture

Status: Active » Needs review
StatusFileSize
new540 bytes

Attached patch lets you override override the default, similar to how variable_email lets you set/override the defaults for it's html_mail type variables.

Example usage, where we override the user_mail_register_no_approval_required_body default to be compatible with logintoboggan.

/**
 * Implements hook_variable_info_alter().
 */
function example_variable_info_alter(&$info, $options) {
  $info['user_mail_register_no_approval_required_[mail_part]']['children']['user_mail_register_no_approval_required_body']['default'] = "<p>[user:name],</p>

<p>Thank you for registering.</p>

<p>IMPORTANT:<br/>
For full site access, you will need to click on this link or copy and paste it in your browser:</p>

<p>[user:validate-url]</p>

<p>This will verify your account and log you into the site. In the future you will be able to log in to [site:login-url] using the username and password that you created during registration.</p>";
}
mrfelton’s picture

Status: Needs review » Needs work

This is not working properly - it seems that the tokens from the default text are being parsed at the wrong time. For example, with no value for user_mail_password_reset_body stored in the database, when you go to edit the variable through the variable_admin interface, the tokens have already been processed.

mrfelton’s picture

Status: Needs work » Needs review
StatusFileSize
new623 bytes

Updated patch resolves issue from #2

jose reyero’s picture

Status: Needs review » Needs work

The idea looks good, though this isssue is not specific of user mail variables.

Maybe we should fix variable_get_default() instead to check for $variable['default'] before 'default callback' ?