admin管理员组文章数量:1426036
Can I customize and edit the subject field in the "Password Reset" notification mails sent from our multisite blogs? I have tried some plugins like My brand login and white label CMS etc. But I can't edit this in password reset notifications .
Does anyone help me understand how to edit it ?
Update:
Today I tried with another installation .But it is not making any change.The Word 'wordpress' in from mail address is still there.I have added -
add_filter ( 'wp_mail_from_name', 'my_filter_that_outputs_the_new_name' );
to the code given by Doug .Am I missing something?Could you help me to solve this?
Can I customize and edit the subject field in the "Password Reset" notification mails sent from our multisite blogs? I have tried some plugins like My brand login and white label CMS etc. But I can't edit this in password reset notifications .
Does anyone help me understand how to edit it ?
Update:
Today I tried with another installation .But it is not making any change.The Word 'wordpress' in from mail address is still there.I have added -
add_filter ( 'wp_mail_from_name', 'my_filter_that_outputs_the_new_name' );
to the code given by Doug .Am I missing something?Could you help me to solve this?
Share Improve this question edited Dec 11, 2010 at 13:24 user391 asked Sep 2, 2010 at 16:48 user391user391 5493 gold badges13 silver badges25 bronze badges1 Answer
Reset to default 8You can change them using a filter. The filter hooks you want to use are:
- For the first email message (confirming they really want to reset the password):
'retrieve_password_title'
'retrieve_password_message'
- For the follow-up email message (sending the new username and password):
'password_reset_title'
'password_reset_message'
Update: To create and use these filters, put the following or similar code in your functions.php
file:
function my_retrieve_password_subject_filter($old_subject) {
// $old_subject is the default subject line created by WordPress.
// (You don't have to use it.)
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$subject = sprintf( __('[%s] Password Reset'), $blogname );
// This is how WordPress creates the subject line. It looks like this:
// [Doug's blog] Password Reset
// You can change this to fit your own needs.
// You have to return your new subject line:
return $subject;
}
function my_retrieve_password_message_filter($old_message, $key) {
// $old_message is the default message already created by WordPress.
// (You don't have to use it.)
// $key is the password-like token that allows the user to get
// a new password
$message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
$message .= network_site_url() . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
$message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
// This is how WordPress creates the message.
// You can change this to meet your own needs.
// You have to return your new message:
return $message;
}
// To get these filters up and running:
add_filter ( 'retrieve_password_title', 'my_retrieve_password_subject_filter', 10, 1 );
add_filter ( 'retrieve_password_message', 'my_retrieve_password_message_filter', 10, 2 );
You would do something similar if you also want to modify the follow-up email. Use the WordPress code as a guide for creating the subject line and message (look for the variables $title
and $message
).
本文标签: customizationCustomizing the Subject Field in WordPress39 Notification Emails
版权声明:本文标题:customization - Customizing the Subject Field in WordPress' Notification Emails? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745463382a2659424.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论