WordPress用户信息更新时发送通知邮件

为WordPress加入用户信息更新时发送通知邮件功能

先来看一下效果图:

图片[1]-WordPress用户信息更新时发送通知邮件-吾爱博客

在你主题的functions.php文件内加入代码

function user_profile_update( $user_id ) {
$site_url = get_bloginfo('wpurl');
$site_name = get_bloginfo('wpname');
$user_info = get_userdata( $user_id );
$to = $user_info->user_email;
$subject = "".$site_name."账户更新";
$message = emailheadertop.'您在' .$site_name. '账户资料修改成功!<p style="color: #6e6e6e;font-size:13px;line-height:24px;">亲爱的 ' .$user_info->display_name . '<br/>您的资料修改成功!<br/>感谢您的光临!</p>';

wp_mail( $to, $subject, $message, "Content-Type: text/html; charset=UTF-8");
}
add_action( 'profile_update', 'user_profile_update', 10, 2);

 

这样就可以了,还可以根据自己的需求改一改样式

温馨提示: 本文最后更新于2019-06-28,至今已有1944天,某些文章具有时效性,若有错误或已失效,请在下方留言
© 版权声明
THE END
喜欢就支持一下吧❀
点赞1投币 分享
评论 抢沙发

    请登录后查看评论内容