我正在尝试修改当用户被邀请加入我的多站点网络时发送给他们的电子邮件。了解我只能使用可插拔功能,如何使用必须使用的插件覆盖默认电子邮件?现在它不允许我覆盖并显示默认文本。
这是我当前的代码:
if ( !function_exists(\'wp_new_user_notification\') ) {
function wp_new_user_notification( $user_id, $plaintext_pass = \'\' ) {
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
$siteUrl = get_site_url().\'/login\';
$email_subject = "Welcome to Dewsly ".$user_login;
$message = sprintf(__(\'New user registration on your blog %s:\'), get_option(\'blogname\')) . "\\r\\n\\r\\n";
$message .= sprintf(__(\'Username: %s\'), $user_login) . "\\r\\n\\r\\n";
$message .= sprintf(__(\'E-mail: %s\'), $user_email) . "\\r\\n";
@wp_mail(get_option(\'admin_email\'), $email_subject, $message);
if ( empty($plaintext_pass) )
return;
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="background:#e5f6fb">
</body>
</html>
<?php
$message = ob_get_contents();
ob_end_clean();
wp_mail($user_email, $email_subject, $message);
}
}