本文实例讲述了如何修正WordPress新用户注册邮件内容,由于零碎发送的邮件是纯文本类型的,页面不太美观,又没有方法发送自定义的HTML格局的邮件,将修正办法分享给大家供大家参考。详细办法如下:
最简略的方法
办法一、间接手动修正:
修正wordpresswp-includes目录的pluggable.php,中的这段:
$message = sprintf(__('Username: %s'), $user_login) . "";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "";
$message .= wp_login_url() . "";
wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
$message .= sprintf(__('欢送退出***网')) . "rn";
$message .= sprintf(__('Username: %s'), $user_login) . "rn";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "rn";
$message .= wp_login_url() . "rn";
$message .= sprintf(__('账号需进一步审核才能够登入,请告诉网站治理员')) . "rn";
wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
咱们在以后主题的functions.php中退出从新定义的wp_new_user_notification函数即可,上面是一个示例,能够依据本人的需要进行修正:
if ( !function_exists('wp_new_user_notification') ) :
/**
* Notify the blog admin of a new user, normally via email.
*
* @since 2.0
*
* @param int $user_id User ID
* @param string $plaintext_pass Optional. The user's plaintext password
*/
function wp_new_user_notification($user_id, $plaintext_pass = '') {
$user = get_userdata( $user_id );
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
// 获取博客称号
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
// 给治理员发送的邮件内容,这里是HTML格局
$message = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>新用户注册</title></head><body><p align="center"><table cellpadding="0" cellspacing="1" style="border:3px solid #d9e9f1;background:#7fbddd; text-align:left;"><tr><td style="padding:0;"><table cellpadding="30" cellspacing="0" style="border:1px solid #ffffff;background:#f7f7f7;width:500px;"><tr><td style="line-height:2;font-size:12px;">您的网站 <strong>' . $blogname . '</strong> 有新用户注册。
用户名:' . $user_login . '
Email:' . $user_email . '
假如您不是 <strong>' . $blogname . '</strong> 的治理员,请间接疏忽本邮件!</p></td></tr></table></td></tr></table></p></body></html>';
// 给网站治理员发送邮件
$message_headers = "Content-Type: text/html; charset="utf-8"n";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message, $message_headers);
if ( emptyempty($plaintext_pass) )
return;
// 你能够在此修正发送给新用户的告诉Email,这里是HTML格局
$message = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>新用户注册</title></head><body><p align="center"><table cellpadding="0" cellspacing="1" style="border:3px solid #d9e9f1;background:#7fbddd; text-align:left;"><tr><td style="padding:0;"><table cellpadding="30" cellspacing="0" style="border:1px solid #ffffff;background:#f7f7f7;width:500px;"><tr><td style="line-height:2;font-size:12px;">您刚刚在网站 <strong>' . $blogname . '</strong> 注册一个帐号。
用户名:' . $user_login . '
登录明码:' . $plaintext_pass . '
登录网址:<a href="' . wp_login_url() . '">' . wp_login_url() . '</a>
假如您没有在 <strong>'. $blogname . '</strong> 注册过任何信息,请间接疏忽本邮件!</p></td></tr></table></td></tr></table></p></body></html>';
// sprintf(__('[%s] Your username and password'), $blogname) 为邮件题目
wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message, $message_headers);
}
endif;
心愿本文所述对大家的WordPress建站有所协助。
以上就是安达网络工作室关于《WordPress修改新用户注册邮件内容的方法》的一些看法。更多内容请查看本栏目更多内容!
友谊链接关于一个每个独立博客来说能够说是必需的,有不少人抉择在侧边栏退出友谊链接栏目,但建设一个独立...
wordpress完成随机文章 ralix曾公布过对于wordpress随机文章的相干插件的点评文章(“wordpress插件之...
之前我都是用二级域名的方式来存储图片、JS 和 CSS ,前些天在推特上的一位顺序员 yoursunny 通知我,光用二...
民间引见: 1,经过插件能够创立adsense广告位。 2,能够间接经过工具在网管中心验证网站。 之前站长David...
本文实例讲述了WordPress中增加语音搜寻性能的完成办法。分享给大家供大家参考。详细剖析如下: WordPress能...
本文实例讲述了WordPress统计以后页面数据库查问次数及耗费工夫的办法。分享给大家供大家参考。详细剖析如下...