Posted by gone on February 3, 2009 at 6:38am
Jump to:
| Project: | U Create |
| Version: | 6.x-1.0-beta4 |
| Component: | ucreate.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Came as a surprise when I updated the default 'Welcome' e-mail text that is mailed to new users via /admin/user/settings, and discovered that when creating new users via UCreate, the text hadn't changed.
Noticed that ucreate.module doesn't check for overridden alternative message from the _variable table in the same way user.module does:
<?php
// Check if an admin setting overrides the default string.
if ($admin_setting = variable_get('user_mail_'. $messageid, FALSE)) {
return strtr($admin_setting, $variables);
}
// No override, return with default strings.
else {
.......
?>Can similar function be added into ucreate so we don't have to make changes both in the admin dashboard as well as the hardcoded version in the module code?
Comments
#1
It _can_ and it _should_ :-)
Would rather see this in 6.x though...
#2
That's fair enough! It was just on a 5x site that I noticed :)
Cheers. Thanks for making the issue title more sane too :)
#3
o, actually this should be 6.
#4
More simple to implement, put the mail template in a theme_ function.
At least, developpers whoule be able to theme them without hacking the core.
A new fieldset in the user setting page is better, but it would be a good begining.
#5
Did this get implemented? The message seems to be uncustomisable at present. This is unfortunate as the password in the message is instantly obsolete - I'm using account reminder set to day 0 to send a welcome email, as discussed in #867966: Give user importer the option to send welcome emails to new users. This generates a new password that replaces the one in the UCreate welcome email.
#6
Minor note to this - I solved it for my site by editing line 321 of ucreate.module to change the message text. May be of use to other people.
#7
The module would benefit from following core user email settings, providing the customizable email contents (complete with 'token' support) on admin/user/settings, stored in a variable, which would be overridable and exportable by features...
Eg,
* Welcome, new user created by administrator
* Welcome, new user created by site member.
* Welcome, no approval required
* Welcome, awaiting administrator approval
* Password recovery email
* Account activation email
* Account blocked email
* Account deleted email
I mentioned this also in comment #8 on #906774-8: Use impersonation to submit core user_register form before finding this issue.
#8
Hacking the core module is not recommended, so it would definitely be a plus to be able to override the email template.
#9
Here's a dirty way to alter the email with hook_mail_alter:
<?php
function mymodule_mail_alter(&$messages){
if ($messages['id'] == 'ucreate_ucreate-create'){
$body = $messages['body'];
$body = str_replace("Hello", "Dear", $body);
$body = str_replace("We have created an account for you on", "An account has been created for you on", $body);
$body = str_replace("You can log in to the site", "You can log in to the site using the top 'Members only' login form", $body);
$messages['body'] = $body;
}
}
?>
It's not ideal but it works for me and we don't touch the core module...