Ticket #49661: #wp_mailer.patch
File #wp_mailer.patch, 143.8 KB (added by , 5 years ago) |
---|
-
wp-admin/includes/misc.php
1302 1302 1303 1303 $switched_locale = switch_to_locale( get_user_locale() ); 1304 1304 1305 /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 1306 $email_text = __( 1307 'Howdy ###USERNAME###, 1305 /** 1306 * Filter removed 1307 * 1308 * $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email ); 1309 * 1310 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1311 * 1312 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1313 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1314 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1315 * 1316 */ 1308 1317 1318 $wp_mail = array( 1319 'id' => 'new_admin_email', 1320 'group' => 'admin', 1321 1322 'to' => $value, 1323 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1324 'subject' => __( '[{{SITENAME}}] New Admin Email Address' ), 1325 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1326 'message' => __( 1327 '{{HEADER}} 1328 1309 1329 You recently requested to have the administration email address on 1310 1330 your site changed. 1311 1331 1312 1332 If this is correct, please click on the following link to change it: 1313 ###ADMIN_URL### 1333 {{ADMIN_URL}} 1314 1334 1315 1335 You can safely ignore and delete this email if you do not want to 1316 1336 take this action. 1317 1337 1318 This email has been sent to ###EMAIL###1338 This email has been sent to {{EMAIL}} 1319 1339 1320 Regards, 1321 All at ###SITENAME### 1322 ###SITEURL###' 1340 {{FOOTER}}' 1341 ), 1342 'replacements' => array( 1343 '{{ADMIN_URL}}' => esc_url_raw( self_admin_url( 'options.php?adminhash=' . $hash ) ), 1344 '{{EMAIL}}' => $value, 1345 ), 1323 1346 ); 1324 1347 1325 /** 1326 * Filters the text of the email sent when a change of site admin email address is attempted. 1327 * 1328 * The following strings have a special meaning and will get replaced dynamically: 1329 * ###USERNAME### The current user's username. 1330 * ###ADMIN_URL### The link to click on to confirm the email change. 1331 * ###EMAIL### The proposed new site admin email address. 1332 * ###SITENAME### The name of the site. 1333 * ###SITEURL### The URL to the site. 1334 * 1335 * @since MU (3.0.0) 1336 * @since 4.9.0 This filter is no longer Multisite specific. 1337 * 1338 * @param string $email_text Text in the email. 1339 * @param array $new_admin_email { 1340 * Data relating to the new site admin email address. 1341 * 1342 * @type string $hash The secure hash used in the confirmation link URL. 1343 * @type string $newemail The proposed new site admin email address. 1344 * } 1345 */ 1346 $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email ); 1348 $wp_mailer = WP_Mailer::getInstance(); 1349 $wp_mailer->send( $wp_mail ); 1347 1350 1348 $current_user = wp_get_current_user();1349 $content = str_replace( '###USERNAME###', $current_user->user_login, $content );1350 $content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash=' . $hash ) ), $content );1351 $content = str_replace( '###EMAIL###', $value, $content );1352 $content = str_replace( '###SITENAME###', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $content );1353 $content = str_replace( '###SITEURL###', home_url(), $content );1354 1355 wp_mail(1356 $value,1357 sprintf(1358 /* translators: New admin email address notification email subject. %s: Site title. */1359 __( '[%s] New Admin Email Address' ),1360 wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES )1361 ),1362 $content1363 );1364 1365 1351 if ( $switched_locale ) { 1366 1352 restore_previous_locale(); 1367 1353 } -
wp-admin/includes/privacy-tools.php
556 556 $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS ); 557 557 $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration ); 558 558 559 $export_file_url = get_post_meta( $request_id, '_export_file_url', true );560 $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );561 $site_url = home_url();562 563 559 /** 564 * Filters the recipient of the personal data export email notification. 565 * Should be used with great caution to avoid sending the data export link to wrong emails. 560 * Filters removed 566 561 * 567 * @since 5.3.0 562 * $request_email = apply_filters( 'wp_privacy_personal_data_email_to', $request->email, $request ); 563 * $subject = apply_filters( 'wp_privacy_personal_data_email_subject', $subject, $site_name, $email_data ); 564 * $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $email_data ); 565 * $headers = apply_filters( 'wp_privacy_personal_data_email_headers', $headers, $subject, $content, $request_id, $email_data ); 568 566 * 569 * @param string $request_email The email address of the notification recipient. 570 * @param WP_User_Request $request The request that is initiating the notification. 571 */ 572 $request_email = apply_filters( 'wp_privacy_personal_data_email_to', $request->email, $request ); 573 574 $email_data = array( 575 'request' => $request, 576 'expiration' => $expiration, 577 'expiration_date' => $expiration_date, 578 'message_recipient' => $request_email, 579 'export_file_url' => $export_file_url, 580 'sitename' => $site_name, 581 'siteurl' => $site_url, 582 ); 583 584 /* translators: Personal data export notification email subject. %s: Site title. */ 585 $subject = sprintf( __( '[%s] Personal Data Export' ), $site_name ); 586 587 /** 588 * Filters the subject of the email sent when an export request is completed. 567 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 589 568 * 590 * @since 5.3.0 569 * apply_filters( 'wp_mailer', $mail, $caller_info ); 570 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 571 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 591 572 * 592 * @param string $subject The email subject.593 * @param string $sitename The name of the site.594 * @param array $email_data {595 * Data relating to the account action email.596 *597 * @type WP_User_Request $request User request object.598 * @type int $expiration The time in seconds until the export file expires.599 * @type string $expiration_date The localized date and time when the export file expires.600 * @type string $message_recipient The address that the email will be sent to. Defaults601 * to the value of `$request->email`, but can be changed602 * by the `wp_privacy_personal_data_email_to` filter.603 * @type string $export_file_url The export file URL.604 * @type string $sitename The site name sending the mail.605 * @type string $siteurl The site URL sending the mail.606 * }607 573 */ 608 $subject = apply_filters( 'wp_privacy_personal_data_email_subject', $subject, $site_name, $email_data );609 574 610 /* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */611 $email_text = __(612 ' Howdy,575 $wp_mail = array( 576 'id' => 'wp_privacy_personal_data', 577 'group' => 'privacy', 613 578 579 'to' => $request->email, 580 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 581 'subject' => __( '[{{SITENAME}}] Personal Data Export' ), 582 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 583 'message' => __( 584 '{{HEADER}} 585 614 586 Your request for an export of personal data has been completed. You may 615 587 download your personal data by clicking on the link below. For privacy 616 and security, we will automatically delete the file on ###EXPIRATION###,588 and security, we will automatically delete the file on {{EXPIRATION}}, 617 589 so please download it before then. 618 590 619 ###LINK### 591 {{EXPORTLINK}} 620 592 621 Regards, 622 All at ###SITENAME### 623 ###SITEURL###' 593 {{FOOTER}}' 594 ), 595 'replacements' => array( 596 '{{EXPIRATION}}' => $expiration_date, 597 '{{EXPORTLINK}}' => esc_url_raw( get_post_meta( $request_id, '_export_file_url', true ) ), 598 ), 624 599 ); 625 600 626 /** 627 * Filters the text of the email sent with a personal data export file. 628 * 629 * The following strings have a special meaning and will get replaced dynamically: 630 * ###EXPIRATION### The date when the URL will be automatically deleted. 631 * ###LINK### URL of the personal data export file for the user. 632 * ###SITENAME### The name of the site. 633 * ###SITEURL### The URL to the site. 634 * 635 * @since 4.9.6 636 * @since 5.3.0 Introduced the `$email_data` array. 637 * 638 * @param string $email_text Text in the email. 639 * @param int $request_id The request ID for this personal data export. 640 * @param array $email_data { 641 * Data relating to the account action email. 642 * 643 * @type WP_User_Request $request User request object. 644 * @type int $expiration The time in seconds until the export file expires. 645 * @type string $expiration_date The localized date and time when the export file expires. 646 * @type string $message_recipient The address that the email will be sent to. Defaults 647 * to the value of `$request->email`, but can be changed 648 * by the `wp_privacy_personal_data_email_to` filter. 649 * @type string $export_file_url The export file URL. 650 * @type string $sitename The site name sending the mail. 651 * @type string $siteurl The site URL sending the mail. 652 */ 653 $content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $email_data ); 601 $wp_mailer = WP_Mailer::getInstance(); 602 $mail_success = $wp_mailer->send( $wp_mail ); 654 603 655 $content = str_replace( '###EXPIRATION###', $expiration_date, $content );656 $content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content );657 $content = str_replace( '###EMAIL###', $request_email, $content );658 $content = str_replace( '###SITENAME###', $site_name, $content );659 $content = str_replace( '###SITEURL###', esc_url_raw( $site_url ), $content );660 661 $headers = '';662 663 /**664 * Filters the headers of the email sent with a personal data export file.665 *666 * @since 5.4.0667 *668 * @param string|array $headers The email headers.669 * @param string $subject The email subject.670 * @param string $content The email content.671 * @param int $request_id The request ID.672 * @param array $email_data {673 * Data relating to the account action email.674 *675 * @type WP_User_Request $request User request object.676 * @type int $expiration The time in seconds until the export file expires.677 * @type string $expiration_date The localized date and time when the export file expires.678 * @type string $message_recipient The address that the email will be sent to. Defaults679 * to the value of `$request->email`, but can be changed680 * by the `wp_privacy_personal_data_email_to` filter.681 * @type string $export_file_url The export file URL.682 * @type string $sitename The site name sending the mail.683 * @type string $siteurl The site URL sending the mail.684 * }685 */686 $headers = apply_filters( 'wp_privacy_personal_data_email_headers', $headers, $subject, $content, $request_id, $email_data );687 688 $mail_success = wp_mail( $request_email, $subject, $content, $headers );689 690 604 if ( $switched_locale ) { 691 605 restore_previous_locale(); 692 606 } -
wp-admin/includes/schema.php
1178 1178 $site_admins = get_site_option( 'site_admins' ); 1179 1179 } 1180 1180 1181 /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those areplaceholders. */1181 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1182 1182 $welcome_email = __( 1183 'Howdy USERNAME, 1183 '{{HEADER}} 1184 1184 1185 Your new SITE_NAMEsite has been successfully set up at:1186 BLOG_URL 1185 Your new {{SITENAME}} site has been successfully set up at: 1186 {{SITEURL}} 1187 1187 1188 1188 You can log in to the administrator account with the following information: 1189 1189 1190 Username: USERNAME 1191 Password: PASSWORD 1192 Log in here: BLOG_URLwp-login.php 1190 Username: {{USERNAME}} 1191 Password: {{PASSWORD}} 1193 1192 1194 We hope you enjoy your new site. Thanks! 1193 Log in here: {{LOGINLINK}} 1195 1194 1196 --The Team @ SITE_NAME' 1195 We hope you will enjoy your new site. 1196 1197 {{FOOTER}}' 1197 1198 ); 1198 1199 1199 1200 $misc_exts = array( -
wp-admin/includes/upgrade.php
603 603 $name = $user->user_login; 604 604 $login_url = wp_login_url(); 605 605 606 $message = sprintf( 607 /* translators: New site notification email. 1: New site URL, 2: User login, 3: User password or password reset link, 4: Login URL. */ 608 __( 609 'Your new WordPress site has been successfully set up at: 606 $wp_mail = array( 607 'id' => 'install', 608 'group' => 'admin', 610 609 611 %1$s 610 'to' => $user->user_email, 611 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 612 'subject' => __( '[{{SITENAME}}] New WordPress Site' ), 613 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 614 'message' => __( 615 'Your new WordPress site has been successfully set up at: 612 616 617 {{SITEURL}} 618 613 619 You can log in to the administrator account with the following information: 614 620 615 Username: %2$s 616 Password: %3$s 617 Log in here: %4$s 621 Username: {{USERNAME}} 622 Password: {{PASSWORD}} 618 623 624 Log in here: {{LOGINLINK}} 625 619 626 We hope you enjoy your new site. Thanks! 620 627 621 628 --The WordPress Team 622 https://wordpress.org/ 623 ' 629 https://wordpress.org/' ), 630 'replacements' => array( 631 '{{SITEURL}}' => esc_url_raw( $blog_url ), 632 '{{SITENAME}}' => $blog_title, 633 '{{USERNAME}}' => $user->user_login, 634 '{{PASSWORD}}' => $password, 635 '{{LOGINLINK}}' => esc_url_raw( wp_login_url() ), 624 636 ), 625 $blog_url,626 $name,627 $password,628 $login_url629 637 ); 630 638 631 wp_mail( $email, __( 'New WordPress Site' ), $message ); 639 $wp_mailer = WP_Mailer::getInstance(); 640 $wp_mailer->send( $wp_mail ); 632 641 } 633 642 endif; 634 643 -
wp-admin/ms-delete-site.php
52 52 53 53 $switched_locale = switch_to_locale( get_locale() ); 54 54 55 /* translators: Do not translate USERNAME, URL_DELETE, SITE_NAME: those are placeholders. */ 56 $content = __( 57 "Howdy ###USERNAME###, 55 /** 56 * Filter removed 57 * 58 * $content = apply_filters( 'delete_site_email_content', $content ); 59 * 60 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 61 * 62 * apply_filters( 'wp_mailer', $mail, $caller_info ); 63 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 64 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 65 * 66 */ 58 67 59 You recently clicked the 'Delete Site' link on your site and filled in a 68 $wp_mail = array( 69 'id' => 'delete_site_email', 70 'group' => 'ms', 71 72 'to' => get_option( 'admin_email' ), 73 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 74 'subject' => __( '[{{SITENAME}}] Delete My Site' ), 75 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 76 'message' => __( 77 '{{HEADER}} 78 79 As {{USERNAME}}, you recently clicked the \'Delete Site\' link on your site and filled in a 60 80 form on that page. 61 81 62 82 If you really want to delete your site, click the link below. You will not 63 83 be asked to confirm again so only click this link if you are absolutely certain: 64 ###URL_DELETE### 84 {{URL_DELETE}} 65 85 66 86 If you delete your site, please consider opening a new site here 67 87 some time in the future! (But remember your current site and username 68 88 are gone forever.) 69 89 70 Thanks for using the site, 71 Webmaster 72 ###SITE_NAME###" 90 {{FOOTER}}' 91 ), 92 'replacements' => array( 93 '{{URL_DELETE}}' => esc_url_raw( admin_url( 'ms-delete-site.php?h=' . $hash ) ) 94 ), 73 95 ); 74 /**75 * Filters the email content sent when a site in a Multisite network is deleted.76 *77 * @since 3.0.078 *79 * @param string $content The email content that will be sent to the user who deleted a site in a Multisite network.80 */81 $content = apply_filters( 'delete_site_email_content', $content );82 96 83 $content = str_replace( '###USERNAME###', $user->user_login, $content ); 84 $content = str_replace( '###URL_DELETE###', $url_delete, $content ); 85 $content = str_replace( '###SITE_NAME###', get_network()->site_name, $content ); 97 $wp_mailer = WP_Mailer::getInstance(); 98 $wp_mailer->send( $wp_mail ); 86 99 87 wp_mail(88 get_option( 'admin_email' ),89 sprintf(90 /* translators: %s: Site title. */91 __( '[%s] Delete My Site' ),92 wp_specialchars_decode( get_option( 'blogname' ) )93 ),94 $content95 );96 97 100 if ( $switched_locale ) { 98 101 restore_previous_locale(); 99 102 } -
wp-admin/network/site-new.php
144 144 update_user_option( $user_id, 'primary_blog', $id, true ); 145 145 } 146 146 147 wp_mail( 148 get_site_option( 'admin_email' ), 149 sprintf( 150 /* translators: New site notification email subject. %s: Network title. */ 151 __( '[%s] New Site Created' ), 152 get_network()->site_name 153 ), 154 sprintf( 155 /* translators: New site notification email. 1: User login, 2: Site URL, 3: Site title. */ 156 __( 157 'New site created by %1$s 147 $admin_email = get_site_option( 'admin_email' ); 158 148 159 Address: %2$s 160 Name: %3$s' 161 ), 162 $current_user->user_login, 163 get_site_url( $id ), 164 wp_unslash( $title ) 149 /** 150 * 151 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 152 * 153 * apply_filters( 'wp_mailer', $mail, $caller_info ); 154 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 155 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 156 * 157 */ 158 159 160 $wp_mail = array( 161 'id' => 'site_new', 162 'group' => 'network', 163 164 'to' => get_site_option( 'admin_email' ), 165 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 166 'subject' => __( '[{{SITENAME}}] New Site Created' ), 167 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 168 'message' => __( 169 '{{HEADER}} 170 171 New site created by {{USERNAME}} 172 173 Address: {{SITEURL}} 174 Name: {{BLOGNAME}} 175 176 {{FOOTER}}' 165 177 ), 166 sprintf( 167 'From: "%1$s" <%2$s>', 168 _x( 'Site Admin', 'email "From" field' ), 169 get_site_option( 'admin_email' ) 170 ) 178 'headers' => array( 179 'From' => "{$admin_email} <{$admin_email}>", 180 ), 181 'replacements' => array( 182 '{{SITENAME}}' => get_network()->site_name, 183 '{{SITEURL}}' => esc_url_raw( get_site_url( $id ) ), 184 '{{USERNAME}}' => $current_user->user_login, 185 '{{BLOGNAME}}' => wp_unslash( $title ), 186 ), 171 187 ); 188 189 $wp_mailer = WP_Mailer::getInstance(); 190 $wp_mailer->send( $wp_mail ); 191 172 192 wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); 173 193 wp_redirect( 174 194 add_query_arg( -
wp-admin/user-new.php
112 112 113 113 $switched_locale = switch_to_locale( get_user_locale( $user_details ) ); 114 114 115 /* translators: 1: Site title, 2: Site URL, 3: User role, 4: Activation URL. */ 116 $message = __( 117 'Hi, 115 /** 116 * No filter removed 117 * 118 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 119 * 120 * apply_filters( 'wp_mailer', $mail, $caller_info ); 121 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 122 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 123 * 124 */ 118 125 119 You\'ve been invited to join \'%1$s\' at 120 %2$s with the role of %3$s. 126 $wp_mail = array( 127 'id' => 'invite', 128 'group' => 'blog', 121 129 130 'to' => $new_user_email, 131 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 132 'subject' => __( '[{{SITENAME}}] Joining Confirmation' ), 133 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 134 'message' => __( 135 '{{HEADER}} 136 137 You have been invited to join "{{SITENAME}}" at 138 {{SITEURL}} with the role of {{ROLE}}. 139 122 140 Please click the following link to confirm the invite: 123 %4$s' 124 ); 141 {{INVITE_URL}} 125 142 126 wp_mail( 127 $new_user_email, 128 sprintf( 129 /* translators: Joining confirmation notification email subject. %s: Site title. */ 130 __( '[%s] Joining Confirmation' ), 131 wp_specialchars_decode( get_option( 'blogname' ) ) 143 {{FOOTER}}' 132 144 ), 133 sprintf( 134 $message, 135 get_option( 'blogname' ), 136 home_url(), 137 wp_specialchars_decode( translate_user_role( $role['name'] ) ), 138 home_url( "/newbloguser/$newuser_key/" ) 139 ) 145 'replacements' => array( 146 '{{ROLE}}' => translate_user_role( $role['name'] ), 147 '{{INVITE_URL}}' => esc_url_raw( home_url( "/newbloguser/$newuser_key/" ) ), 148 ), 140 149 ); 141 150 151 $wp_mailer = WP_Mailer::getInstance(); 152 $wp_mailer->send( $wp_mail ); 153 154 142 155 if ( $switched_locale ) { 143 156 restore_previous_locale(); 144 157 } -
wp-includes/class-wp-mailer.php
1 <?php 2 /** 3 * API for easily sending customisable mails. 4 * 5 * @package WordPress 6 * @subpackage Mail 7 * @since 5.5.0 8 */ 9 10 class WP_Mailer{ 11 12 /** 13 * Unique class instance 14 * 15 * @static object 16 */ 17 private static $_instance = null; 18 19 /** 20 * Stores generated mail ids for uniqueness 21 * 22 * @static array 23 */ 24 private static $_ids = array(); 25 26 /** 27 * The occurence of debug_backtrace to identify the caller 28 * 29 * @var array 30 */ 31 private $call = array(); 32 33 /** 34 * Constructor 35 * 36 * Constructor is private, use GLOBALS variable $wp_mailer or getInstance() static function instead 37 */ 38 private function __construct() { 39 } 40 41 /** 42 * Returns class instance 43 * 44 * @return object Class instance. 45 */ 46 public static function getInstance() { 47 48 if ( is_null( self::$_instance ) ) { 49 self::$_instance = new self(); 50 } 51 52 return self::$_instance; 53 } 54 55 /** 56 * Sending using wp_mail. 57 * 58 * @param array $mail The mail parameters, an array with structured information to send mail 59 * to : (string|array) the email recipient(s) 60 * subject : (string) mail subject 61 * message : (string) message content before replacements 62 * headers : (string|array) if an array, each item is a pair of ( Header => Value, ) 63 * example 1 : array( 'From' => 'me@my.awesome.blog', ) 64 * example 2 : array( 'X-Repeatable' => array( 'value1', 'value2', ) 65 * attachments : (string|array) 66 * 67 * replacements : (array) each item is a pair of ( Text_to_replace => Text_replaced ) 68 * example : array( '{{MYEMAIL}}' => 'me@my.awesome.blog', ) 69 * id : (string) used to individualize filter 70 * 71 * @return bool Whether the mail was sent successfully. 72 */ 73 public function send( $mail ) { 74 75 $this->get_called(); 76 77 $current_user = wp_get_current_user(); 78 79 $defaults = array( 80 'id' => $this->get_mail_id(), 81 'group' => 'wordpress', 82 83 'subject' => '', 84 'message' => '', 85 'headers' => array(), 86 'attachments' => array(), 87 88 /* make sure reserved words {{HEADER}} and {{FOOTER}} are first. */ 89 'replacements' => array( 90 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 91 '{{HEADER}}' => __( '{{SITENAME}} 92 {{SITEURL}} 93 94 Hello,' ), 95 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 96 '{{FOOTER}}' => __( 'With gratitude' ), 97 '{{SITENAME}}' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 98 '{{SITEURL}}' => esc_url_raw( home_url() ), 99 '{{USERNAME}}' => $current_user->user_login, 100 ), 101 ); 102 103 /** 104 * Filters the default message components. 105 * 106 * @since 5.5 107 * 108 * @param array $defaults Default values of api. 109 * @param array $mail Current values of api. 110 * @param array $call Debug_backtrace occurence of api caller. 111 */ 112 $defaults = apply_filters( 'wp_mailer_defaults', $defaults, $mail, $this->call ); 113 114 $mail = array_replace_recursive( $defaults, $mail ); 115 116 117 /** 118 * Filters the message components for a specific mail. 119 * 120 * @since 5.5 121 * 122 * @param array $mail Current values of api. 123 * @param array $call Debug_backtrace occurence of api caller. 124 */ 125 $mail = apply_filters( "wp_mailer_{$mail['id']}", $mail, $this->call ); 126 127 /** 128 * Filters the message components for a group of mails ( network, ms, admin, blog, privacy, ...) 129 * 130 * @since 5.5 131 * 132 * @param array $mail Current values of api. 133 * @param array $call Debug_backtrace occurence of api caller. 134 */ 135 $mail = apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $this->call ); 136 137 /** 138 * Filters the message components. 139 * 140 * @since 5.5 141 * 142 * @param array $mail Current values of api. 143 * @param array $call Debug_backtrace occurence of api caller. 144 */ 145 $mail = apply_filters( "wp_mailer_mail", $mail, $this->call ); 146 147 $search = array_keys( $mail['replacements'] ); 148 $mail['subject'] = str_replace( $search, $mail['replacements'], $mail['subject'] ); 149 $mail['subject'] = wp_specialchars_decode( $mail['subject'], ENT_QUOTES ); 150 $mail['message'] = str_replace( $search, $mail['replacements'], $mail['message'] ); 151 $mail['message'] = wp_specialchars_decode( $mail['message'], ENT_QUOTES ); 152 153 /* to can be an array */ 154 if ( !isset( $mail['to'] ) ) return false; 155 if ( !is_array( $mail['to'] ) ) $mail['to'] = array( $mail['to'] ); 156 else $mail['to'] = array_unique( $mail['to'] ); 157 158 /* headers argument is mixed (string|array) in wp_mail */ 159 if ( is_array( $mail['headers'] ) ) { 160 $headers = array(); 161 foreach( $mail['headers'] as $key => $value ) { 162 if ( is_array( $value ) ) { /* repeatable header */ 163 foreach( $value as $v ) { 164 $headers[] = trim( $key ) . ': ' . trim( $v ) . "\n"; 165 } 166 } 167 else 168 { 169 $headers[] = trim( $key ) . ': ' . trim( $value ) . "\n"; 170 } 171 } 172 } 173 else 174 { 175 $headers = $mail['headers']; 176 } 177 178 $return = true; 179 180 foreach( $mail['to'] as $to ) 181 { 182 if ( ! $return ) break; 183 $return = wp_mail( 184 $to, 185 $mail['subject'], 186 $mail['message'], 187 $headers, 188 $mail['attachments'] 189 ); 190 } 191 192 return $return; 193 } 194 195 /** 196 * Generates a mail id based on caller and occurence 197 * 198 */ 199 private function get_mail_id() { 200 201 if ( empty( $this->call ) ) return 'unknown'; 202 203 $ids = array(); 204 if ( isset( $this->call['class'] ) ) $ids[] = $this->call['class']; 205 if ( isset( $this->call['function'] ) ) $ids[] = $this->call['function']; 206 if ( empty( $ids ) && isset( $this->call['file'] ) ) $ids[] = substr( basename( $this->call['file'] ), 0, -4 ); 207 $id = implode ( '_', $ids ); 208 if ( isset( self::$_ids[$id] ) ) $ids[] = ++self::$_ids[$id]; 209 else self::$_ids[$id] = 0; 210 211 return implode ( '_', $ids ); 212 } 213 214 /** 215 * For filters and eventually mail id (caller and arguments) 216 * 217 */ 218 private function get_called() { 219 $calls = debug_backtrace(); 220 $call = array(); 221 for( $i = 2; $i >= 0; $i-- ) { 222 if ( isset( $calls[$i] ) ) { 223 $call = $calls[$i]; 224 break; 225 } 226 } 227 $this->call = $call; 228 } 229 } 230 No newline at end of file -
wp-includes/functions.php
7002 7002 return; 7003 7003 } 7004 7004 7005 /* translators: Do not translate OLD_EMAIL, NEW_EMAIL, SITENAME, SITEURL: those are placeholders. */7006 $email_change_text = __(7007 'Hi,7008 7009 This notice confirms that the admin email address was changed on ###SITENAME###.7010 7011 The new admin email address is ###NEW_EMAIL###.7012 7013 This email has been sent to ###OLD_EMAIL###7014 7015 Regards,7016 All at ###SITENAME###7017 ###SITEURL###'7018 );7019 7020 $email_change_email = array(7021 'to' => $old_email,7022 /* translators: Site admin email change notification email subject. %s: Site title. */7023 'subject' => __( '[%s] Admin Email Changed' ),7024 'message' => $email_change_text,7025 'headers' => '',7026 );7027 7028 // Get site name.7029 $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );7030 7031 7005 /** 7032 * Filter s the contents of the email notification sent when the site admin email address is changed.7006 * Filter removed 7033 7007 * 7034 * @since 4.9.07008 * $email_change_email = apply_filters( 'site_admin_email_change_email', $email_change_email, $old_email, $new_email ); 7035 7009 * 7036 * @param array $email_change_email { 7037 * Used to build wp_mail(). 7010 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 7038 7011 * 7039 * @type string $to The intended recipient. 7040 * @type string $subject The subject of the email. 7041 * @type string $message The content of the email. 7042 * The following strings have a special meaning and will get replaced dynamically: 7043 * - ###OLD_EMAIL### The old site admin email address. 7044 * - ###NEW_EMAIL### The new site admin email address. 7045 * - ###SITENAME### The name of the site. 7046 * - ###SITEURL### The URL to the site. 7047 * @type string $headers Headers. 7048 * } 7049 * @param string $old_email The old site admin email address. 7050 * @param string $new_email The new site admin email address. 7012 * apply_filters( 'wp_mailer', $mail, $caller_info ); 7013 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 7014 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 7015 * 7051 7016 */ 7052 $email_change_email = apply_filters( 'site_admin_email_change_email', $email_change_email, $old_email, $new_email );7053 7017 7054 $email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] ); 7055 $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] ); 7056 $email_change_email['message'] = str_replace( '###SITENAME###', $site_name, $email_change_email['message'] ); 7057 $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); 7018 $wp_mail = array( 7019 'id' => 'site_admin_email_change', 7020 'group' => 'admin', 7058 7021 7059 wp_mail( 7060 $email_change_email['to'], 7061 sprintf( 7062 $email_change_email['subject'], 7063 $site_name 7022 'to' => $old_email, 7023 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 7024 'subject' => __( '[{{SITENAME}}] Admin Email Changed' ), 7025 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 7026 'message' => __( 7027 '{{HEADER}} 7028 7029 This notice confirms that the admin email address was changed on {{SITENAME}}. 7030 7031 The new admin email address is {{NEW_EMAIL}}. 7032 7033 This email has been sent to {{OLD_EMAIL}}. 7034 7035 {{FOOTER}}' 7064 7036 ), 7065 $email_change_email['message'], 7066 $email_change_email['headers'] 7037 'replacements' => array( 7038 '{{OLD_EMAIL}}' => $old_email, 7039 '{{NEW_EMAIL}}' => $new_email, 7040 7041 ), 7067 7042 ); 7043 7044 $wp_mailer = WP_Mailer::getInstance(); 7045 $wp_mailer->send( $wp_mail ); 7068 7046 } 7069 7047 7070 7048 /** -
wp-includes/ms-functions.php
903 903 * Filter {@see 'wpmu_signup_blog_notification'} to bypass this function or 904 904 * replace it with your own notification behavior. 905 905 * 906 * Filter {@see 'wpmu_signup_blog_notification_email'} and907 * {@see 'wpmu_signup_blog_notification_subject'} to change the content908 * and subject line of the email sent to newly registered users.909 *910 906 * @since MU (3.0.0) 911 907 * 912 908 * @param string $domain The new blog domain. … … 949 945 $admin_email = 'support@' . $_SERVER['SERVER_NAME']; 950 946 } 951 947 $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); 952 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";953 948 954 949 $user = get_user_by( 'login', $user_login ); 950 951 $new_siteurl = is_ssl() ? 'https://' : 'http://'; 952 $new_siteurl .= $domain . $path; 953 955 954 $switched_locale = switch_to_locale( get_user_locale( $user ) ); 956 955 957 $message = sprintf(958 /**959 * Filters the message content of the new blog notification email.960 *961 * Content should be formatted for transmission via wp_mail().962 *963 * @since MU (3.0.0)964 *965 * @param string $content Content of the notification email.966 * @param string $domain Site domain.967 * @param string $path Site path.968 * @param string $title Site title.969 * @param string $user_login User login name.970 * @param string $user_email User email address.971 * @param string $key Activation key created in wpmu_signup_blog().972 * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id.973 */974 apply_filters(975 'wpmu_signup_blog_notification_email',976 /* translators: New site notification email. 1: Activation URL, 2: New site URL. */977 __( "To activate your blog, please click the following link:\n\n%1\$s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%2\$s" ),978 $domain,979 $path,980 $title,981 $user_login,982 $user_email,983 $key,984 $meta985 ),986 $activate_url,987 esc_url( "http://{$domain}{$path}" ),988 $key989 );990 956 991 $subject = sprintf( 992 /** 993 * Filters the subject of the new blog notification email. 994 * 995 * @since MU (3.0.0) 996 * 997 * @param string $subject Subject of the notification email. 998 * @param string $domain Site domain. 999 * @param string $path Site path. 1000 * @param string $title Site title. 1001 * @param string $user_login User login name. 1002 * @param string $user_email User email address. 1003 * @param string $key Activation key created in wpmu_signup_blog(). 1004 * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id. 1005 */ 1006 apply_filters( 1007 'wpmu_signup_blog_notification_subject', 1008 /* translators: New site notification email subject. 1: Network title, 2: New site URL. */ 1009 _x( '[%1$s] Activate %2$s', 'New site notification email subject' ), 1010 $domain, 1011 $path, 1012 $title, 1013 $user_login, 1014 $user_email, 1015 $key, 1016 $meta 957 /** 958 * Filters removed 959 * 960 * $message = sprintf( 961 * apply_filters( 962 * 'wpmu_signup_blog_notification_email', 963 * __( "To activate your blog, please click the following link:\n\n%1\$s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%2\$s" ), 964 * $domain, 965 * $path, 966 * $title, 967 * $user_login, 968 * $user_email, 969 * $key, 970 * $meta 971 * ), 972 * $activate_url, 973 * esc_url( "http://{$domain}{$path}" ), 974 * $key 975 * ); 976 * 977 * $subject = sprintf( 978 * apply_filters( 979 * 'wpmu_signup_blog_notification_subject', 980 * _x( '[%1$s] Activate %2$s', 'New site notification email subject' ), 981 * $domain, 982 * $path, 983 * $title, 984 * $user_login, 985 * $user_email, 986 * $key, 987 * $meta 988 * ), 989 * $from_name, 990 * esc_url( 'http://' . $domain . $path ) 991 * ); 992 * 993 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 994 * 995 * apply_filters( 'wp_mailer', $mail, $caller_info ); 996 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 997 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 998 * 999 */ 1000 1001 $wp_mail = array( 1002 'id' => 'wpmu_signup_blog_notification', 1003 'group' => 'ms', 1004 1005 'to' => $user_email, 1006 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1007 'subject' => __( '[{{SITENAME}}] Activate {{NEW_SITEURL}}' ), 1008 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1009 'message' => __( 1010 '{{HEADER}} 1011 1012 To activate your blog, please click the following link: {{ACTIVATE_URL}} 1013 1014 After you activate, you will receive *another email* with your login 1015 1016 and you will be able to visit your new site here: {{NEW_SITEURL}} 1017 1018 {{FOOTER}}' 1017 1019 ), 1018 $from_name, 1019 esc_url( 'http://' . $domain . $path ) 1020 'headers' => array( 1021 'From' => "{$from_name} <{$admin_email}>", 1022 'Content-Type' => 'text/plain; charset="' . get_option( 'blog_charset' ) . '"', 1023 ), 1024 'replacements' => array( 1025 '{{SITENAME}}' => $from_name, 1026 '{{USERNAME}}' => $user_login, 1027 '{{ACTIVATE_URL}}' => esc_url_raw( $activate_url ), 1028 '{{NEW_SITEURL}}' => esc_url_raw( $new_siteurl ), 1029 ), 1020 1030 ); 1021 1031 1022 wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 1032 $wp_mailer = WP_Mailer::getInstance(); 1033 $wp_mailer->send( $wp_mail ); 1023 1034 1024 1035 if ( $switched_locale ) { 1025 1036 restore_previous_locale(); … … 1038 1049 * Filter {@see 'wpmu_signup_user_notification'} to bypass this function or 1039 1050 * replace it with your own notification behavior. 1040 1051 * 1041 * Filter {@see 'wpmu_signup_user_notification_email'} and1042 * {@see 'wpmu_signup_user_notification_subject'} to change the content1043 * and subject line of the email sent to newly registered users.1044 *1045 1052 * @since MU (3.0.0) 1046 1053 * 1047 1054 * @param string $user_login The user's login name. … … 1066 1073 } 1067 1074 1068 1075 $user = get_user_by( 'login', $user_login ); 1069 $switched_locale = switch_to_locale( get_user_locale( $user ) );1070 1076 1071 1077 // Send email with activation link. 1072 1078 $admin_email = get_site_option( 'admin_email' ); … … 1074 1080 $admin_email = 'support@' . $_SERVER['SERVER_NAME']; 1075 1081 } 1076 1082 $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); 1077 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";1078 $message = sprintf(1079 /**1080 * Filters the content of the notification email for new user sign-up.1081 *1082 * Content should be formatted for transmission via wp_mail().1083 *1084 * @since MU (3.0.0)1085 *1086 * @param string $content Content of the notification email.1087 * @param string $user_login User login name.1088 * @param string $user_email User email address.1089 * @param string $key Activation key created in wpmu_signup_user().1090 * @param array $meta Signup meta data. Default empty array.1091 */1092 apply_filters(1093 'wpmu_signup_user_notification_email',1094 /* translators: New user notification email. %s: Activation URL. */1095 __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),1096 $user_login,1097 $user_email,1098 $key,1099 $meta1100 ),1101 site_url( "wp-activate.php?key=$key" )1102 );1103 1083 1104 $subject = sprintf( 1105 /** 1106 * Filters the subject of the notification email of new user signup. 1107 * 1108 * @since MU (3.0.0) 1109 * 1110 * @param string $subject Subject of the notification email. 1111 * @param string $user_login User login name. 1112 * @param string $user_email User email address. 1113 * @param string $key Activation key created in wpmu_signup_user(). 1114 * @param array $meta Signup meta data. Default empty array. 1115 */ 1116 apply_filters( 1117 'wpmu_signup_user_notification_subject', 1118 /* translators: New user notification email subject. 1: Network title, 2: New user login. */ 1119 _x( '[%1$s] Activate %2$s', 'New user notification email subject' ), 1120 $user_login, 1121 $user_email, 1122 $key, 1123 $meta 1084 $switched_locale = switch_to_locale( get_user_locale( $user ) ); 1085 1086 /** 1087 * Filters removed 1088 * 1089 * $message = sprintf( 1090 * apply_filters( 1091 * 'wpmu_signup_user_notification_email', 1092 * __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ), 1093 * $user_login, 1094 * $user_email, 1095 * $key, 1096 * $meta 1097 * ), 1098 * site_url( "wp-activate.php?key=$key" ) 1099 * ); 1100 * 1101 * $subject = sprintf( 1102 * apply_filters( 1103 * 'wpmu_signup_user_notification_subject', 1104 * _x( '[%1$s] Activate %2$s', 'New user notification email subject' ), 1105 * $user_login, 1106 * $user_email, 1107 * $key, 1108 * $meta 1109 * ), 1110 * $from_name, 1111 * $user_login 1112 * ); 1113 * 1114 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1115 * 1116 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1117 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1118 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1119 * 1120 */ 1121 1122 $wp_mail = array( 1123 'id' => 'wpmu_signup_user_notification', 1124 'group' => 'ms', 1125 1126 'to' => $user_email, 1127 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1128 'subject' => __( '[{{SITENAME}}] Activate {{USERNAME}}' ), 1129 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1130 'message' => __( 1131 '{{HEADER}} 1132 1133 To activate your user, please click the following link: {{ACTIVATE_URL}} 1134 1135 After you activate, you will receive *another email* with your login. 1136 1137 {{FOOTER}}' 1124 1138 ), 1125 $from_name, 1126 $user_login 1139 'headers' => array( 1140 'From' => "{$from_name} <{$admin_email}>", 1141 'Content-Type' => 'text/plain; charset="' . get_option( 'blog_charset' ) . '"', 1142 ), 1143 'replacements' => array( 1144 '{{SITENAME}}' => $from_name, 1145 '{{USERNAME}}' => $user_login, 1146 '{{ACTIVATE_URL}}' => esc_url_raw( site_url( "wp-activate.php?key={$key}" ) ), 1147 ), 1127 1148 ); 1128 1149 1129 wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 1150 $wp_mailer = WP_Mailer::getInstance(); 1151 $wp_mailer->send( $wp_mail ); 1130 1152 1131 1153 if ( $switched_locale ) { 1132 1154 restore_previous_locale(); … … 1383 1405 /** 1384 1406 * Notifies the network admin that a new site has been activated. 1385 1407 * 1386 * Filter {@see 'newblog_notify_siteadmin'} to change the content of1387 * the notification email.1388 *1389 1408 * @since MU (3.0.0) 1390 * @since 5.1.0 $blog_id now supports input from the {@see 'wp_initialize_site'} action.1391 1409 * 1392 1410 * @param WP_Site|int $blog_id The new site's object or ID. 1393 1411 * @param string $deprecated Not used. … … 1407 1425 return false; 1408 1426 } 1409 1427 1410 $options_site_url = esc_url( network_admin_url( 'settings.php' ) );1411 1412 1428 switch_to_blog( $blog_id ); 1413 1429 $blogname = get_option( 'blogname' ); 1414 1430 $siteurl = site_url(); 1415 1431 restore_current_blog(); 1416 1432 1417 $msg = sprintf(1418 /* translators: New site notification email. 1: Site URL, 2: User IP address, 3: URL to Network Settings screen. */1419 __(1420 'New Site: %1$s1421 URL: %2$s1422 Remote IP address: %3$s1423 1424 Disable these notifications: %4$s'1425 ),1426 $blogname,1427 $siteurl,1428 wp_unslash( $_SERVER['REMOTE_ADDR'] ),1429 $options_site_url1430 );1431 1433 /** 1432 * Filters the message body of the new site activation email sent 1433 * to the network administrator. 1434 * Filter removed 1434 1435 * 1435 * @since MU (3.0.0) 1436 * @since 5.4.0 The `$blog_id` parameter was added. 1436 * $msg = apply_filters( 'newblog_notify_siteadmin', $msg, $blog_id ); 1437 1437 * 1438 * @param string $msg Email body. 1439 * @param int $blog_id The new site's ID. 1438 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1439 * 1440 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1441 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1442 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1443 * 1440 1444 */ 1441 $msg = apply_filters( 'newblog_notify_siteadmin', $msg, $blog_id );1442 1445 1443 /* translators: New site notification email subject. %s: New site URL. */ 1444 wp_mail( $email, sprintf( __( 'New Site Registration: %s' ), $siteurl ), $msg ); 1446 $wp_mail = array( 1447 'id' => 'newblog_notify_siteadmin', 1448 'group' => 'network', 1445 1449 1450 'to' => $email, 1451 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1452 'subject' => __( 'New Site Registration: {{SITEURL}}' ), 1453 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1454 'message' => __( 1455 '{{HEADER}} 1456 1457 New Site: {{SITENAME}} 1458 URL : {{SITEURL}} 1459 Remote IP address : {{REMOTEADDR}} 1460 1461 Disable these notifications: {{ADMIN_URL}} 1462 1463 {{FOOTER}}' 1464 ), 1465 'replacements' => array( 1466 '{{SITEURL}}' => esc_url_raw( $siteurl ), 1467 '{{REMOTEADDR}}' => wp_unslash( $_SERVER['REMOTE_ADDR'] ), 1468 '{{ADMIN_URL}}' => esc_url_raw( network_admin_url( 'settings.php' ) ), 1469 ), 1470 ); 1471 1472 $wp_mailer = WP_Mailer::getInstance(); 1473 $wp_mailer->send( $wp_mail ); 1474 1446 1475 return true; 1447 1476 } 1448 1477 … … 1449 1478 /** 1450 1479 * Notifies the network admin that a new user has been activated. 1451 1480 * 1452 * Filter {@see 'newuser_notify_siteadmin'} to change the content of1453 * the notification email.1454 *1455 1481 * @since MU (3.0.0) 1456 1482 * 1457 1483 * @param int $user_id The new user's ID. … … 1470 1496 1471 1497 $user = get_userdata( $user_id ); 1472 1498 1473 $options_site_url = esc_url( network_admin_url( 'settings.php' ) ); 1499 /** 1500 * Filter removed 1501 * 1502 * $msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user ); 1503 * 1504 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1505 * 1506 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1507 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1508 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1509 * 1510 */ 1474 1511 1475 $msg = sprintf( 1476 /* translators: New user notification email. 1: User login, 2: User IP address, 3: URL to Network Settings screen. */ 1477 __( 1478 'New User: %1$s 1479 Remote IP address: %2$s 1512 $wp_mail = array( 1513 'id' => 'newuser_notify_siteadmin', 1514 'group' => 'network', 1480 1515 1481 Disable these notifications: %3$s' 1516 'to' => $email, 1517 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1518 'subject' => __( 'New User Registration: {{USERNAME}}' ), 1519 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1520 'message' => __( 1521 '{{HEADER}} 1522 1523 New User: {{USERNAME}} 1524 1525 Remote IP address : {{REMOTEADDR}} 1526 1527 Disable these notifications: {{ADMIN_URL}} 1528 1529 {{FOOTER}}' 1482 1530 ), 1483 $user->user_login, 1484 wp_unslash( $_SERVER['REMOTE_ADDR'] ), 1485 $options_site_url 1531 'replacements' => array( 1532 '{{USERNAME}}' => $user->user_login, 1533 '{{REMOTEADDR}}' => wp_unslash( $_SERVER['REMOTE_ADDR'] ), 1534 '{{ADMIN_URL}}' => esc_url_raw( network_admin_url( 'settings.php' ) ), 1535 ), 1486 1536 ); 1487 1537 1488 /** 1489 * Filters the message body of the new user activation email sent 1490 * to the network administrator. 1491 * 1492 * @since MU (3.0.0) 1493 * 1494 * @param string $msg Email body. 1495 * @param WP_User $user WP_User instance of the new user. 1496 */ 1497 $msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user ); 1538 $wp_mailer = WP_Mailer::getInstance(); 1539 $wp_mailer->send( $wp_mail ); 1498 1540 1499 /* translators: New user notification email subject. %s: User login. */1500 wp_mail( $email, sprintf( __( 'New User Registration: %s' ), $user->user_login ), $msg );1501 1502 1541 return true; 1503 1542 } 1504 1543 … … 1552 1591 * 1553 1592 * Filter {@see 'wpmu_welcome_notification'} to disable or bypass. 1554 1593 * 1555 * Filter {@see 'update_welcome_email'} and {@see 'update_welcome_subject'} to1556 * modify the content and subject line of the notification email.1557 *1558 1594 * @since MU (3.0.0) 1559 1595 * 1560 1596 * @param int $blog_id Blog ID. … … 1565 1601 * @return bool 1566 1602 */ 1567 1603 function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) { 1568 $current_network = get_network();1569 1570 1604 /** 1571 1605 * Filters whether to bypass the welcome email after site activation. 1572 1606 * … … 1584 1618 return false; 1585 1619 } 1586 1620 1621 $current_network = get_network(); 1622 if ( empty( $current_network->site_name ) ) { 1623 $current_network->site_name = 'WordPress'; 1624 } 1625 1587 1626 $user = get_userdata( $user_id ); 1588 1627 1628 $admin_email = get_site_option( 'admin_email' ); 1629 1630 if ( '' == $admin_email ) { 1631 $admin_email = 'support@' . $_SERVER['SERVER_NAME']; 1632 } 1633 $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); 1634 1635 $url = get_blogaddress_by_id( $blog_id ); 1636 $login_url = $url . 'wp-login.php'; 1637 1638 // Back-compat for pre-5.5. 1639 $welcome_backward_compat = array( 'SITE_NAME' => '{{SITENAME}}', 'BLOG_URL' => '{{SITEURL}}', 'USERNAME' => '{{USERNAME}}', 'PASSWORD' => '{{PASSWORD}}', 'BLOG_URLwp-login.php' => '{{LOGINLINK}}', '{{{{' => '{{', '}}}}' => '}}', ); 1640 $welcome_search = array_keys( $welcome_backward_compat ); 1641 $welcome_email = get_site_option( 'welcome_email' ); 1642 $welcome_email = str_replace( $welcome_search, $welcome_backward_compat, $welcome_email ); 1643 1589 1644 $switched_locale = switch_to_locale( get_user_locale( $user ) ); 1590 1645 1591 $welcome_email = get_site_option( 'welcome_email' );1592 1646 if ( false == $welcome_email ) { 1593 /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those areplaceholders. */1647 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1594 1648 $welcome_email = __( 1595 'Howdy USERNAME, 1649 '{{HEADER}} 1596 1650 1597 Your new SITE_NAMEsite has been successfully set up at:1598 BLOG_URL 1651 Your new {{SITENAME}} site has been successfully set up at: 1652 {{SITEURL}} 1599 1653 1600 1654 You can log in to the administrator account with the following information: 1601 1655 1602 Username: USERNAME 1603 Password: PASSWORD 1604 Log in here: BLOG_URLwp-login.php 1656 Username: {{USERNAME}} 1657 Password: {{PASSWORD}} 1605 1658 1606 We hope you enjoy your new site. Thanks! 1659 Log in here: {{LOGINLINK}} 1607 1660 1608 --The Team @ SITE_NAME' 1661 We hope you will enjoy your new site. 1662 1663 {{FOOTER}}' 1609 1664 ); 1610 1665 } 1611 1666 1612 $url = get_blogaddress_by_id( $blog_id );1613 1614 $welcome_email = str_replace( 'SITE_NAME', $current_network->site_name, $welcome_email );1615 $welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email );1616 $welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );1617 $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );1618 $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );1619 1620 1667 /** 1621 * Filter s the content of the welcome email after site activation.1668 * Filter removed 1622 1669 * 1623 * Content should be formatted for transmission via wp_mail(). 1670 * $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta ); 1671 * $subject = apply_filters( 'update_welcome_subject', sprintf( $subject, $current_network->site_name, wp_unslash( $title ) ) ); 1624 1672 * 1625 * @since MU (3.0.0)1673 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1626 1674 * 1627 * @param string $welcome_email Message body of the email. 1628 * @param int $blog_id Blog ID. 1629 * @param int $user_id User ID. 1630 * @param string $password User password. 1631 * @param string $title Site title. 1632 * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id. 1675 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1676 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1677 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1678 * 1633 1679 */ 1634 $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );1635 $admin_email = get_site_option( 'admin_email' );1636 1680 1637 if ( '' == $admin_email ) {1638 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];1639 }1681 $wp_mail = array( 1682 'id' => 'update_welcome', 1683 'group' => 'ms', 1640 1684 1641 $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); 1642 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n"; 1643 $message = $welcome_email; 1685 'to' => $user->user_email, 1686 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1687 'subject' => __( 'New {{SITENAME}} Site: {{BLOGNAME}}' ), 1688 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1689 'message' => $welcome_email, 1690 'headers' => array( 1691 'From' => "{$from_name} <{$admin_email}>", 1692 'Content-Type' => 'text/plain; charset="' . get_option( 'blog_charset' ) . '"', 1693 ), 1694 'replacements' => array( 1695 '{{SITENAME}}' => $current_network->site_name, 1696 '{{SITEURL}}' => esc_url_raw( $url ), 1697 '{{USERNAME}}' => $user->user_login, 1698 '{{PASSWORD}}' => $password, 1699 '{{LOGINLINK}}' => esc_url_raw( $login_url ), 1700 '{{BLOGNAME}}' => wp_unslash( $title ), 1701 ), 1702 ); 1644 1703 1645 if ( empty( $current_network->site_name ) ) { 1646 $current_network->site_name = 'WordPress'; 1647 } 1704 $wp_mailer = WP_Mailer::getInstance(); 1705 $wp_mailer->send( $wp_mail ); 1648 1706 1649 /* translators: New site notification email subject. 1: Network title, 2: New site title. */1650 $subject = __( 'New %1$s Site: %2$s' );1651 1652 /**1653 * Filters the subject of the welcome email after site activation.1654 *1655 * @since MU (3.0.0)1656 *1657 * @param string $subject Subject of the email.1658 */1659 $subject = apply_filters( 'update_welcome_subject', sprintf( $subject, $current_network->site_name, wp_unslash( $title ) ) );1660 1661 wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );1662 1663 1707 if ( $switched_locale ) { 1664 1708 restore_previous_locale(); 1665 1709 } … … 1683 1727 * @return bool 1684 1728 */ 1685 1729 function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) { 1686 $current_network = get_network();1687 1688 1730 /** 1689 1731 * Filters whether to bypass the welcome email after user activation. 1690 1732 * … … 1700 1742 return false; 1701 1743 } 1702 1744 1703 $welcome_email = get_site_option( 'welcome_user_email' ); 1745 $current_network = get_network(); 1746 if ( empty( $current_network->site_name ) ) { 1747 $current_network->site_name = 'WordPress'; 1748 } 1704 1749 1705 1750 $user = get_userdata( $user_id ); 1706 1751 1707 $switched_locale = switch_to_locale( get_user_locale( $user ) );1708 1709 /**1710 * Filters the content of the welcome email after user activation.1711 *1712 * Content should be formatted for transmission via wp_mail().1713 *1714 * @since MU (3.0.0)1715 *1716 * @param string $welcome_email The message body of the account activation success email.1717 * @param int $user_id User ID.1718 * @param string $password User password.1719 * @param array $meta Signup meta data. Default empty array.1720 */1721 $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta );1722 $welcome_email = str_replace( 'SITE_NAME', $current_network->site_name, $welcome_email );1723 $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );1724 $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );1725 $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );1726 1727 1752 $admin_email = get_site_option( 'admin_email' ); 1728 1729 1753 if ( '' == $admin_email ) { 1730 1754 $admin_email = 'support@' . $_SERVER['SERVER_NAME']; 1731 1755 } 1732 1733 1756 $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) ); 1734 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";1735 $message = $welcome_email;1736 1757 1737 if ( empty( $current_network->site_name ) ) { 1738 $current_network->site_name = 'WordPress'; 1758 // Back-compat for pre-5.5. 1759 $welcome_backward_compat = array( 'SITE_NAME' => '{{SITENAME}}', 'USERNAME' => '{{USERNAME}}', 'PASSWORD' => '{{PASSWORD}}', 'LOGINLINK' => '{{LOGINLINK}}', '{{{{' => '{{', '}}}}' => '}}', ); 1760 $welcome_search = array_keys( $welcome_backward_compat ); 1761 $welcome_email = get_site_option( 'welcome_user_email' ); 1762 $welcome_email = str_replace( $welcome_search, $welcome_backward_compat, $welcome_email ); 1763 1764 $switched_locale = switch_to_locale( get_user_locale( $user ) ); 1765 1766 if ( false == $welcome_email ) { 1767 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1768 $welcome_email = __( 1769 '{{HEADER}} 1770 1771 As {{USERNAME}}, your new account is set up. 1772 1773 You can log in with the following information: 1774 Username: {{USERNAME}} 1775 Password: {{PASSWORD}} 1776 1777 Log in here: {{LOGINLINK}} 1778 1779 1780 {{FOOTER}}' 1781 ); 1739 1782 } 1740 1783 1741 /* translators: New user notification email subject. 1: Network title, 2: New user login. */1742 $subject = __( 'New %1$s User: %2$s' );1743 1744 1784 /** 1745 * Filter s the subject of the welcome email after user activation.1785 * Filter removed 1746 1786 * 1747 * @since MU (3.0.0) 1787 * $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta ); 1788 * $subject = apply_filters( 'update_welcome_user_subject', sprintf( $subject, $current_network->site_name, $user->user_login ) ); 1748 1789 * 1749 * @param string $subject Subject of the email. 1790 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1791 * 1792 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1793 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1794 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1795 * 1750 1796 */ 1751 $subject = apply_filters( 'update_welcome_user_subject', sprintf( $subject, $current_network->site_name, $user->user_login ) );1752 1797 1753 wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 1798 $wp_mail = array( 1799 'id' => 'update_welcome_user', 1800 'group' => 'ms', 1754 1801 1802 'to' => $user->user_email, 1803 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1804 'subject' => __( 'New {{SITENAME}} User: {{USERNAME}}' ), 1805 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1806 'message' => $welcome_email, 1807 'headers' => array( 1808 'From' => "{$from_name} <{$admin_email}>", 1809 'Content-Type' => 'text/plain; charset="' . get_option( 'blog_charset' ) . '"', 1810 ), 1811 'replacements' => array( 1812 '{{SITENAME}}' => $current_network->site_name, 1813 '{{USERNAME}}' => $user->user_login, 1814 '{{PASSWORD}}' => $password, 1815 '{{LOGINLINK}}' => esc_url_raw( wp_login_url() ), 1816 ), 1817 ); 1818 1819 $wp_mailer = WP_Mailer::getInstance(); 1820 $wp_mailer->send( $wp_mail ); 1821 1755 1822 if ( $switched_locale ) { 1756 1823 restore_previous_locale(); 1757 1824 } … … 2276 2343 if ( ! $text ) { 2277 2344 remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' ); 2278 2345 2279 /* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those areplaceholders. */2346 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2280 2347 $text = __( 2281 'Howdy USERNAME, 2348 '{{HEADER}} 2282 2349 2283 Your new account is set up.2350 As {{USERNAME}}, your new account is set up. 2284 2351 2285 2352 You can log in with the following information: 2286 Username: USERNAME 2287 Password: PASSWORD 2288 LOGINLINK 2353 Username: {{USERNAME}} 2354 Password: {{PASSWORD}} 2289 2355 2290 Thanks! 2356 Log in here: {{LOGINLINK}} 2291 2357 2292 --The Team @ SITE_NAME' 2358 2359 {{FOOTER}}' 2293 2360 ); 2294 2361 update_site_option( 'welcome_user_email', $text ); 2295 2362 } … … 2672 2739 2673 2740 $switched_locale = switch_to_locale( get_user_locale() ); 2674 2741 2675 /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2676 $email_text = __( 2677 'Howdy ###USERNAME###, 2742 /** 2743 * Filter removed 2744 * 2745 * $content = apply_filters( 'new_network_admin_email_content', $email_text, $new_admin_email ); 2746 * 2747 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 2748 * 2749 * apply_filters( 'wp_mailer', $mail, $caller_info ); 2750 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 2751 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 2752 * 2753 */ 2678 2754 2679 You recently requested to have the network admin email address on 2755 $wp_mail = array( 2756 'id' => 'new_network_admin_email', 2757 'group' => 'network', 2758 2759 'to' => $value, 2760 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2761 'subject' => __( '[{{SITENAME}}] Network Admin Email Change Request' ), 2762 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2763 'message' => __( 2764 '{{HEADER}} 2765 2766 As {{USERNAME}}, you recently requested to have the network admin email address on 2680 2767 your network changed. 2681 2768 2682 2769 If this is correct, please click on the following link to change it: 2683 ###ADMIN_URL### 2770 {{ADMIN_URL}} 2684 2771 2685 2772 You can safely ignore and delete this email if you do not want to 2686 2773 take this action. 2687 2774 2688 This email has been sent to ###EMAIL###2775 This email has been sent to {{EMAIL}} 2689 2776 2690 Regards, 2691 All at ###SITENAME### 2692 ###SITEURL###' 2777 {{FOOTER}}' 2778 ), 2779 'replacements' => array( 2780 '{{SITENAME}}' => get_site_option( 'site_name' ), 2781 '{{SITEURL}}' => esc_url_raw( network_home_url() ), 2782 '{{ADMIN_URL}}' => esc_url_raw( network_admin_url( 'settings.php?network_admin_hash=' . $hash ) ), 2783 '{{EMAIL}}' => $value, 2784 ), 2693 2785 ); 2694 2786 2695 /** 2696 * Filters the text of the email sent when a change of network admin email address is attempted. 2697 * 2698 * The following strings have a special meaning and will get replaced dynamically: 2699 * ###USERNAME### The current user's username. 2700 * ###ADMIN_URL### The link to click on to confirm the email change. 2701 * ###EMAIL### The proposed new network admin email address. 2702 * ###SITENAME### The name of the network. 2703 * ###SITEURL### The URL to the network. 2704 * 2705 * @since 4.9.0 2706 * 2707 * @param string $email_text Text in the email. 2708 * @param array $new_admin_email { 2709 * Data relating to the new network admin email address. 2710 * 2711 * @type string $hash The secure hash used in the confirmation link URL. 2712 * @type string $newemail The proposed new network admin email address. 2713 * } 2714 */ 2715 $content = apply_filters( 'new_network_admin_email_content', $email_text, $new_admin_email ); 2787 $wp_mailer = WP_Mailer::getInstance(); 2788 $wp_mailer->send( $wp_mail ); 2716 2789 2717 $current_user = wp_get_current_user();2718 $content = str_replace( '###USERNAME###', $current_user->user_login, $content );2719 $content = str_replace( '###ADMIN_URL###', esc_url( network_admin_url( 'settings.php?network_admin_hash=' . $hash ) ), $content );2720 $content = str_replace( '###EMAIL###', $value, $content );2721 $content = str_replace( '###SITENAME###', wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES ), $content );2722 $content = str_replace( '###SITEURL###', network_home_url(), $content );2723 2724 wp_mail(2725 $value,2726 sprintf(2727 /* translators: Email change notification email subject. %s: Network title. */2728 __( '[%s] Network Admin Email Change Request' ),2729 wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES )2730 ),2731 $content2732 );2733 2734 2790 if ( $switched_locale ) { 2735 2791 restore_previous_locale(); 2736 2792 } … … 2770 2826 return; 2771 2827 } 2772 2828 2773 /* translators: Do not translate OLD_EMAIL, NEW_EMAIL, SITENAME, SITEURL: those are placeholders. */2774 $email_change_text = __(2775 'Hi,2776 2777 This notice confirms that the network admin email address was changed on ###SITENAME###.2778 2779 The new network admin email address is ###NEW_EMAIL###.2780 2781 This email has been sent to ###OLD_EMAIL###2782 2783 Regards,2784 All at ###SITENAME###2785 ###SITEURL###'2786 );2787 2788 $email_change_email = array(2789 'to' => $old_email,2790 /* translators: Network admin email change notification email subject. %s: Network title. */2791 'subject' => __( '[%s] Network Admin Email Changed' ),2792 'message' => $email_change_text,2793 'headers' => '',2794 );2795 // Get network name.2796 $network_name = wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES );2797 2798 2829 /** 2799 * Filter s the contents of the email notification sent when the network admin email address is changed.2830 * Filter removed 2800 2831 * 2801 * @since 4.9.02832 * $email_change_email = apply_filters( 'network_admin_email_change_email', $email_change_email, $old_email, $new_email, $network_id ); 2802 2833 * 2803 * @param array $email_change_email { 2804 * Used to build wp_mail(). 2834 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 2805 2835 * 2806 * @type string $to The intended recipient. 2807 * @type string $subject The subject of the email. 2808 * @type string $message The content of the email. 2809 * The following strings have a special meaning and will get replaced dynamically: 2810 * - ###OLD_EMAIL### The old network admin email address. 2811 * - ###NEW_EMAIL### The new network admin email address. 2812 * - ###SITENAME### The name of the network. 2813 * - ###SITEURL### The URL to the site. 2814 * @type string $headers Headers. 2815 * } 2816 * @param string $old_email The old network admin email address. 2817 * @param string $new_email The new network admin email address. 2818 * @param int $network_id ID of the network. 2836 * apply_filters( 'wp_mailer', $mail, $caller_info ); 2837 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 2838 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 2839 * 2819 2840 */ 2820 $email_change_email = apply_filters( 'network_admin_email_change_email', $email_change_email, $old_email, $new_email, $network_id );2821 2841 2822 $email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] ); 2823 $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] ); 2824 $email_change_email['message'] = str_replace( '###SITENAME###', $network_name, $email_change_email['message'] ); 2825 $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); 2842 $wp_mail = array( 2843 'id' => 'network_admin_email_change', 2844 'group' => 'network', 2826 2845 2827 wp_mail( 2828 $email_change_email['to'], 2829 sprintf( 2830 $email_change_email['subject'], 2831 $network_name 2846 'to' => $old_email, 2847 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2848 'subject' => __( '[{{SITENAME}}] Network Admin Email Changed' ), 2849 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2850 'message' => __( 2851 '{{HEADER}} 2852 2853 This notice confirms that the network admin email address was changed on {{SITENAME}}. 2854 2855 The new network admin email address is {{NEW_EMAIL}}. 2856 2857 This email has been sent to {{OLD_EMAIL}}. 2858 2859 {{FOOTER}}' 2832 2860 ), 2833 $email_change_email['message'], 2834 $email_change_email['headers'] 2861 'replacements' => array( 2862 '{{SITENAME}}' => get_site_option( 'site_name' ), 2863 '{{NEW_EMAIL}}' => $new_email, 2864 '{{OLD_EMAIL}}' => $old_email, 2865 ), 2835 2866 ); 2867 2868 $wp_mailer = WP_Mailer::getInstance(); 2869 $wp_mailer->send( $wp_mail ); 2836 2870 } -
wp-includes/pluggable.php
1560 1560 $emails = array_flip( $emails ); 1561 1561 } 1562 1562 1563 $switched_locale = switch_to_locale( get_locale() );1564 1565 1563 $comment_author_domain = ''; 1566 1564 if ( WP_Http::is_ip_address( $comment->comment_author_IP ) ) { 1567 1565 $comment_author_domain = gethostbyaddr( $comment->comment_author_IP ); 1568 1566 } 1569 1567 1570 // The blogname option is escaped with esc_html() on the way into the database in sanitize_option(). 1571 // We want to reverse this for the plain text arena of emails. 1572 $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 1573 $comment_content = wp_specialchars_decode( $comment->comment_content ); 1568 $from_email = 'wordpress@' . preg_replace( '#^www\.#', '', strtolower( $_SERVER['SERVER_NAME'] ) ); 1574 1569 1570 $switched_locale = switch_to_locale( get_locale() ); 1571 1572 $notify_replacements = array ( 1573 '{{THE_TITLE}}' => $post->post_title, 1574 1575 '{{COMMENT_TYPE}}' => __( 'comment' ), 1576 1577 '{{COMMENT_AUTHOR}}' => $comment->comment_author, 1578 '{{REMOTEADDR}}' => $comment->comment_author_IP, 1579 '{{COMMENT_WEBSITE}}' => esc_url_raw( $comment_author_domain ), 1580 '{{COMMENT_URL}}' => esc_url_raw( $comment->comment_author_url ), 1581 '{{COMMENT_CONTENT}}' => wp_specialchars_decode( $comment->comment_content ), 1582 '{{COMMENTS_LINK}}' => esc_url_raw( get_permalink( $comment->comment_post_ID ) . '#comments' ), 1583 '{{COMMENT_LINK}}' => esc_url_raw( get_comment_link( $comment ) ), 1584 1585 '{{APPROVELINK}}' => esc_url_raw( admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ), 1586 '{{SUPPRESSLINK}}' => esc_url_raw( ( EMPTY_TRASH_DAYS ) ? admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) : admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ), 1587 '{{SPAMLINK}}' => esc_url_raw( admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ), 1588 ); 1589 1590 $notify_message = array(); 1591 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1592 $notify_message[] = __( 1593 '{{HEADER}} 1594 1595 New {{COMMENT_TYPE}} on your post "{{THE_TITLE}}" 1596 1597 Website: {{COMMENT_AUTHOR}} (IP address: {{REMOTEADDR}}, {{COMMENT_WEBSITE}}) 1598 1599 URL: {{COMMENT_URL}} 1600 1601 Content: {{COMMENT_CONTENT}}' ); 1602 1575 1603 switch ( $comment->comment_type ) { 1576 1604 case 'trackback': 1577 /* translators: %s: Post title. */ 1578 $notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n"; 1579 /* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */ 1580 $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1581 /* translators: %s: Trackback/pingback/comment author URL. */ 1582 $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; 1583 /* translators: %s: Comment text. */ 1584 $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; 1585 $notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n"; 1586 /* translators: Trackback notification email subject. 1: Site title, 2: Post title. */ 1587 $subject = sprintf( __( '[%1$s] Trackback: "%2$s"' ), $blogname, $post->post_title ); 1605 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1606 $notify_subject = __( '[{{SITENAME}}] Trackback: "{{THE_TITLE}}"' ); 1607 1608 $notify_message[] = ''; 1609 $notify_message[] = __( 'You can see all trackbacks on this post here:' ); 1610 1611 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1612 $notify_replacements ['{{COMMENT_TYPE}}'] = __( 'trackback' ); 1588 1613 break; 1589 1614 1590 1615 case 'pingback': 1591 /* translators: %s: Post title. */ 1592 $notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n"; 1593 /* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */ 1594 $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1595 /* translators: %s: Trackback/pingback/comment author URL. */ 1596 $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; 1597 /* translators: %s: Comment text. */ 1598 $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; 1599 $notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n"; 1600 /* translators: Pingback notification email subject. 1: Site title, 2: Post title. */ 1601 $subject = sprintf( __( '[%1$s] Pingback: "%2$s"' ), $blogname, $post->post_title ); 1616 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1617 $notify_subject = __( '[{{SITENAME}}] Pingback: "{{THE_TITLE}}"' ); 1618 1619 $notify_message[] = ''; 1620 $notify_message[] = __( 'You can see all pingbacks on this post here:' ); 1621 1622 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1623 $notify_replacements ['{{COMMENT_TYPE}}'] = __( 'pingback' ); 1602 1624 break; 1603 1625 1604 1626 default: // Comments. 1605 /* translators: %s: Post title. */1606 $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";1607 /* translators: 1: Comment author's name, 2: Comment author's IP address, 3: Comment author's hostname. */1608 $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";1609 /* translators: %s: Comment author email. */1610 $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";1611 /* translators: %s: Trackback/pingback/comment author URL. */1612 $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";1613 1627 1614 if ( $comment->comment_parent && user_can( $post->post_author, 'edit_comment', $comment->comment_parent ) ) { 1615 /* translators: Comment moderation. %s: Parent comment edit URL. */ 1616 $notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n"; 1628 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1629 $notify_subject = __( '[{{SITENAME}}] Comment: "{{THE_TITLE}}"' ); 1630 1631 $notify_message = array(); 1632 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1633 $notify_message[] = __( 1634 '{{HEADER}} 1635 1636 New {{COMMENT_TYPE}} on your post "{{THE_TITLE}}" 1637 1638 Website: {{COMMENT_AUTHOR}} (IP address: {{REMOTEADDR}}, {{COMMENT_WEBSITE}}) 1639 1640 Email: {{COMMENT_EMAIL}} 1641 URL: {{COMMENT_URL}}' ); 1642 $notify_replacements ['{{COMMENT_EMAIL}}'] = $comment->comment_author_email; 1643 1644 if ( $comment->comment_parent ) { 1645 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1646 $notify_message[] = __( 'In reply to: {{ADMINURL}}' ); 1647 $notify_replacements ['{{ADMINURL}}'] = esc_url_raw( admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ); 1617 1648 } 1618 1649 1619 /* translators: %s: Comment text. */1620 $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";1621 $notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n";1622 /* translators: Comment notification email subject. 1: Site title, 2: Post title. */1623 $ subject = sprintf( __( '[%1$s] Comment: "%2$s"' ), $blogname, $post->post_title);1650 $notify_message[] = ''; 1651 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1652 $notify_message[] = __( 'Comment: {{COMMENT_CONTENT}}' ); 1653 $notify_message[] = ''; 1654 $notify_message[] = __( 'You can see all comments on this post here:' ); 1624 1655 break; 1625 1656 } 1626 1657 1627 $notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n";1628 /* translators: %s: Comment URL. */1629 $notify_message .= sprintf( __( 'Permalink: %s' ), get_comment_link( $comment ) ) . "\r\n";1630 1658 1659 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1660 $notify_message[] = '{{COMMENTS_LINK}}'; 1661 $notify_message[] = ''; 1662 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1663 $notify_message[] = __( 'Permalink: {{COMMENT_LINK}}' ); 1664 1631 1665 if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) { 1666 1632 1667 if ( EMPTY_TRASH_DAYS ) { 1633 /* translators: Comment moderation. %s: Comment action URL. */1634 $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";1668 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1669 $notify_message[] = __( 'Trash it: {{SUPPRESSLINK}}' ); 1635 1670 } else { 1636 /* translators: Comment moderation. %s: Comment action URL. */1637 $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";1671 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1672 $notify_message[] = __( 'Delete it: {{SUPPRESSLINK}}' ); 1638 1673 } 1639 /* translators: Comment moderation. %s: Comment action URL. */1640 $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";1641 }1642 1674 1643 $wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', strtolower( $_SERVER['SERVER_NAME'] ) ); 1644 1645 if ( '' == $comment->comment_author ) { 1646 $from = "From: \"$blogname\" <$wp_email>"; 1647 if ( '' != $comment->comment_author_email ) { 1648 $reply_to = "Reply-To: $comment->comment_author_email"; 1649 } 1650 } else { 1651 $from = "From: \"$comment->comment_author\" <$wp_email>"; 1652 if ( '' != $comment->comment_author_email ) { 1653 $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; 1654 } 1675 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1676 $notify_message[] = __( 'Spam it: {{SPAMLINK}}' ); 1655 1677 } 1656 1678 1657 $ message_headers = "$from\n"1658 . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";1679 $notify_message[] = ''; 1680 $notify_message[] = '{{FOOTER}}'; 1659 1681 1660 if ( isset( $reply_to ) ) {1661 $message_headers .= $reply_to . "\n";1662 }1663 1682 1664 /**1665 * Filters the comment notification email text.1666 *1667 * @since 1.5.21668 *1669 * @param string $notify_message The comment notification email text.1670 * @param int $comment_id Comment ID.1671 */1672 $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );1673 1683 1674 1684 /** 1675 * Filter s the comment notification email subject.1685 * Filter removed 1676 1686 * 1677 * @since 1.5.2 1687 * $notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID ); 1688 * $subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID ); 1689 * $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID ); 1678 1690 * 1679 * @param string $subject The comment notification email subject. 1680 * @param int $comment_id Comment ID. 1681 */ 1682 $subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID ); 1683 1684 /** 1685 * Filters the comment notification email headers. 1691 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1686 1692 * 1687 * @since 1.5.2 1693 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1694 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1695 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1688 1696 * 1689 * @param string $message_headers Headers for the comment notification email.1690 * @param int $comment_id Comment ID.1691 1697 */ 1692 $message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID );1693 1698 1694 foreach ( $emails as $email ) { 1695 wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers ); 1699 $from_email = 'wordpress@' . preg_replace( '#^www\.#', '', strtolower( $_SERVER['SERVER_NAME'] ) ); 1700 1701 $wp_mail = array( 1702 'id' => 'comment_notification', 1703 'group' => 'blog', 1704 1705 'to' => $emails, 1706 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1707 'subject' => $notify_subject, 1708 'message' => implode( "\r\n", $notify_message ), 1709 'headers' => array( 1710 'From' => ( '' == $comment->comment_author ) ? "{$blogname} <{$from_email}>" : "{$comment->comment_author} <{$from_email}>", 1711 'Content-Type' => 'text/plain; charset="' . get_option( 'blog_charset' ) . '"', 1712 ), 1713 'replacements' => $notify_replacements, 1714 ); 1715 1716 if ( '' != $comment->comment_author_email ) { 1717 $wp_mail['headers']['Reply-To'] = "{$comment->comment_author_email} <{$comment->comment_author_email}>"; 1696 1718 } 1697 1719 1720 $wp_mailer = WP_Mailer::getInstance(); 1721 $wp_mailer->send( $wp_mail ); 1722 1698 1723 if ( $switched_locale ) { 1699 1724 restore_previous_locale(); 1700 1725 } … … 1747 1772 } 1748 1773 } 1749 1774 1775 /** 1776 * Filters the list of recipients for comment moderation emails. 1777 * 1778 * @since 3.7.0 1779 * 1780 * @param string[] $emails List of email addresses to notify for comment moderation. 1781 * @param int $comment_id Comment ID. 1782 */ 1783 $emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id ); 1784 1750 1785 $switched_locale = switch_to_locale( get_locale() ); 1751 1786 1752 1787 $comment_author_domain = ''; … … 1756 1791 1757 1792 $comments_waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" ); 1758 1793 1759 // The blogname option is escaped with esc_html() on the way into the database in sanitize_option(). 1760 // We want to reverse this for the plain text arena of emails. 1761 $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 1762 $comment_content = wp_specialchars_decode( $comment->comment_content ); 1794 $notify_replacements = array ( 1795 '{{THE_TITLE}}' => $post->post_title, 1763 1796 1797 '{{COMMENT_TYPE}}' => __( 'comment' ), 1798 1799 '{{COMMENT_AUTHOR}}' => $comment->comment_author, 1800 '{{REMOTEADDR}}' => $comment->comment_author_IP, 1801 '{{COMMENT_WEBSITE}}' => esc_url_raw( $comment_author_domain ), 1802 '{{COMMENT_URL}}' => esc_url_raw( $comment->comment_author_url ), 1803 '{{COMMENT_CONTENT}}' => wp_specialchars_decode( $comment->comment_content ), 1804 '{{COMMENT_LINK}}' => esc_url_raw( get_permalink( $comment->comment_post_ID ) ), 1805 1806 '{{APPROVELINK}}' => esc_url_raw( admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ), 1807 '{{SUPPRESSLINK}}' => esc_url_raw( ( EMPTY_TRASH_DAYS ) ? admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) : admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ), 1808 '{{SPAMLINK}}' => esc_url_raw( admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ), 1809 ); 1810 1811 $notify_message = array(); 1812 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1813 $notify_message[] = __( 1814 '{{HEADER}} 1815 1816 A new {{COMMENT_TYPE}} on the post "{{THE_TITLE}}" is waiting for your approval 1817 {{COMMENT_LINK}} 1818 1819 Website: {{COMMENT_AUTHOR}} (IP address: {{REMOTEADDR}}, {{COMMENT_WEBSITE}}) 1820 1821 URL: {{COMMENT_URL}} 1822 1823 Content: {{COMMENT_CONTENT}}' ); 1824 1764 1825 switch ( $comment->comment_type ) { 1765 1826 case 'trackback': 1766 /* translators: %s: Post title. */ 1767 $notify_message = sprintf( __( 'A new trackback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; 1768 $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n"; 1769 /* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */ 1770 $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1771 /* translators: %s: Trackback/pingback/comment author URL. */ 1772 $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; 1773 $notify_message .= __( 'Trackback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n"; 1827 $notify_replacements ['{{COMMENT_TYPE}}'] = __( 'trackback' ); 1774 1828 break; 1775 1829 1776 1830 case 'pingback': 1777 /* translators: %s: Post title. */ 1778 $notify_message = sprintf( __( 'A new pingback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; 1779 $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n"; 1780 /* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */ 1781 $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1782 /* translators: %s: Trackback/pingback/comment author URL. */ 1783 $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; 1784 $notify_message .= __( 'Pingback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n"; 1831 $notify_replacements ['{{COMMENT_TYPE}}'] = __( 'pingback' ); 1785 1832 break; 1786 1833 1787 1834 default: // Comments. 1788 /* translators: %s: Post title. */ 1789 $notify_message = sprintf( __( 'A new comment on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n"; 1790 $notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n"; 1791 /* translators: 1: Comment author's name, 2: Comment author's IP address, 3: Comment author's hostname. */ 1792 $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1793 /* translators: %s: Comment author email. */ 1794 $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n"; 1795 /* translators: %s: Trackback/pingback/comment author URL. */ 1796 $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n"; 1835 $notify_message = array(); 1836 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1837 $notify_message[] = __( 1838 '{{HEADER}} 1797 1839 1840 A new {{COMMENT_TYPE}} on the post "{{THE_TITLE}}" is waiting for your approval 1841 {{APPROVELINK}} 1842 1843 Website: {{COMMENT_AUTHOR}} (IP address: {{REMOTEADDR}}, {{COMMENT_WEBSITE}}) 1844 1845 Email: {{COMMENT_EMAIL}} 1846 URL: {{COMMENT_URL}}' ); 1847 $notify_replacements ['{{COMMENT_EMAIL}}'] = $comment->comment_author_email; 1848 1798 1849 if ( $comment->comment_parent ) { 1799 /* translators: Comment moderation. %s: Parent comment edit URL. */ 1800 $notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n"; 1850 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1851 $notify_message[] = __( 'In reply to: {{ADMINURL}}' ) . "\r\n"; 1852 $notify_replacements ['{{ADMINURL}}'] = esc_url_raw( admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ); 1801 1853 } 1802 1854 1803 /* translators: %s: Comment text. */ 1804 $notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n"; 1855 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1856 $notify_message[] = __( 'Comment: {{COMMENT_CONTENT}}' ); 1857 $notify_message[] = ''; 1805 1858 break; 1806 1859 } 1807 1860 1808 /* translators: Comment moderation. %s: Comment action URL. */1809 $notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";1861 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1862 $notify_message[] = __( 'Approve it: {{APPROVELINK}}' ); 1810 1863 1811 1864 if ( EMPTY_TRASH_DAYS ) { 1812 /* translators: Comment moderation. %s: Comment action URL. */1813 $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";1865 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1866 $notify_message[] = __( 'Trash it: {{SUPPRESSLINK}}' ); 1814 1867 } else { 1815 /* translators: Comment moderation. %s: Comment action URL. */1816 $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";1868 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1869 $notify_message[] = __( 'Delete it: {{SUPPRESSLINK}}' ); 1817 1870 } 1818 1871 1819 /* translators: Comment moderation. %s: Comment action URL. */1820 $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";1821 1822 $notify_message .= sprintf(1872 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1873 $notify_message[] = __( 'Spam it: {{SPAMLINK}}' ); 1874 $notify_message[] = ''; 1875 $notify_message[] = sprintf( 1823 1876 /* translators: Comment moderation. %s: Number of comments awaiting approval. */ 1824 1877 _n( 1825 1878 'Currently %s comment is waiting for approval. Please visit the moderation panel:', … … 1827 1880 $comments_waiting 1828 1881 ), 1829 1882 number_format_i18n( $comments_waiting ) 1830 ) . "\r\n"; 1831 $notify_message .= admin_url( 'edit-comments.php?comment_status=moderated#wpbody-content' ) . "\r\n"; 1832 1833 /* translators: Comment moderation notification email subject. 1: Site title, 2: Post title. */ 1834 $subject = sprintf( __( '[%1$s] Please moderate: "%2$s"' ), $blogname, $post->post_title ); 1835 $message_headers = ''; 1836 1883 ); 1884 $notify_message[] = admin_url( 'edit-comments.php?comment_status=moderated#wpbody-content' ); 1885 $notify_message[] = ''; 1886 $notify_message[] = '{{FOOTER}}'; 1887 1837 1888 /** 1838 * Filters the list of recipients for comment moderation emails.1889 * Filters removed 1839 1890 * 1840 * @since 3.7.0 1891 * $notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id ); 1892 * $subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id ); 1893 * $message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id ); 1841 1894 * 1842 * @param string[] $emails List of email addresses to notify for comment moderation. 1843 * @param int $comment_id Comment ID. 1844 */ 1845 $emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id ); 1846 1847 /** 1848 * Filters the comment moderation email text. 1895 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1849 1896 * 1850 * @since 1.5.2 1897 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1898 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1899 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1851 1900 * 1852 * @param string $notify_message Text of the comment moderation email.1853 * @param int $comment_id Comment ID.1854 1901 */ 1855 $notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );1856 1902 1857 /** 1858 * Filters the comment moderation email subject. 1859 * 1860 * @since 1.5.2 1861 * 1862 * @param string $subject Subject of the comment moderation email. 1863 * @param int $comment_id Comment ID. 1864 */ 1865 $subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id ); 1903 $wp_mail = array( 1904 'id' => 'comment_moderation', 1905 'group' => 'blog', 1866 1906 1867 /** 1868 * Filters the comment moderation email headers. 1869 * 1870 * @since 2.8.0 1871 * 1872 * @param string $message_headers Headers for the comment moderation email. 1873 * @param int $comment_id Comment ID. 1874 */ 1875 $message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id ); 1907 'to' => $emails, 1908 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1909 'subject' => __( '[{{SITENAME}}] Please moderate: "{{THE_TITLE}}"' ), 1910 'message' => implode( "\r\n", $notify_message ), 1911 'replacements' => $notify_replacements, 1912 ); 1876 1913 1877 foreach ( $emails as $email ) { 1878 wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers ); 1879 } 1914 $wp_mailer = WP_Mailer::getInstance(); 1915 $wp_mailer->send( $wp_mail ); 1880 1916 1881 1917 if ( $switched_locale ) { 1882 1918 restore_previous_locale(); … … 1898 1934 // Send a copy of password change notification to the admin, 1899 1935 // but check to see if it's the admin whose password we're changing, and skip this. 1900 1936 if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) { 1901 /* translators: %s: User name. */ 1902 $message = sprintf( __( 'Password changed for user: %s' ), $user->user_login ) . "\r\n"; 1903 // The blogname option is escaped with esc_html() on the way into the database in sanitize_option(). 1904 // We want to reverse this for the plain text arena of emails. 1905 $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 1906 1907 $wp_password_change_notification_email = array( 1908 'to' => get_option( 'admin_email' ), 1909 /* translators: Password change notification email subject. %s: Site title. */ 1910 'subject' => __( '[%s] Password Changed' ), 1911 'message' => $message, 1912 'headers' => '', 1913 ); 1914 1937 1915 1938 /** 1916 * Filter s the contents of the password change notification email sent to the site admin.1939 * Filter removed 1917 1940 * 1918 * @since 4.9.01941 * $wp_password_change_notification_email = apply_filters( 'wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname ); 1919 1942 * 1920 * @param array $wp_password_change_notification_email { 1921 * Used to build wp_mail(). 1943 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 1922 1944 * 1923 * @type string $to The intended recipient - site admin email address. 1924 * @type string $subject The subject of the email. 1925 * @type string $message The body of the email. 1926 * @type string $headers The headers of the email. 1927 * } 1928 * @param WP_User $user User object for user whose password was changed. 1929 * @param string $blogname The site title. 1945 * apply_filters( 'wp_mailer', $mail, $caller_info ); 1946 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 1947 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 1948 * 1930 1949 */ 1931 $wp_password_change_notification_email = apply_filters( 'wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname );1932 1950 1933 wp_mail( 1934 $wp_password_change_notification_email['to'], 1935 wp_specialchars_decode( sprintf( $wp_password_change_notification_email['subject'], $blogname ) ), 1936 $wp_password_change_notification_email['message'], 1937 $wp_password_change_notification_email['headers'] 1951 $wp_mail = array( 1952 'id' => 'wp_password_change_notification', 1953 'group' => 'admin', 1954 1955 'to' => get_option( 'admin_email' ), 1956 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1957 'subject' => __( '[{{SITENAME}}] Password Changed' ), 1958 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 1959 'message' => __( 1960 '{{HEADER}} 1961 1962 Password changed for user: {{USERNAME}} 1963 1964 {{FOOTER}}' 1965 ), 1966 'replacements' => array( 1967 '{{USERNAME}}' => $user->user_login, 1968 ), 1938 1969 ); 1970 1971 $wp_mailer = WP_Mailer::getInstance(); 1972 $wp_mailer->send( $wp_mail ); 1973 1939 1974 } 1940 1975 } 1941 1976 endif; … … 1968 2003 1969 2004 $user = get_userdata( $user_id ); 1970 2005 1971 // The blogname option is escaped with esc_html() on the way into the database in sanitize_option().1972 // We want to reverse this for the plain text arena of emails.1973 $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );1974 1975 2006 if ( 'user' !== $notify ) { 1976 2007 $switched_locale = switch_to_locale( get_locale() ); 1977 2008 1978 /* translators: %s: Site title. */1979 $message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";1980 /* translators: %s: User login. */1981 $message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";1982 /* translators: %s: User email address. */1983 $message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n";1984 1985 $wp_new_user_notification_email_admin = array(1986 'to' => get_option( 'admin_email' ),1987 /* translators: New user registration notification email subject. %s: Site title. */1988 'subject' => __( '[%s] New User Registration' ),1989 'message' => $message,1990 'headers' => '',1991 );1992 1993 2009 /** 1994 * Filter s the contents of the new user notification email sent to the site admin.2010 * Filter removed 1995 2011 * 1996 * @since 4.9.02012 * $wp_new_user_notification_email_admin = apply_filters( 'wp_new_user_notification_email_admin', $wp_new_user_notification_email_admin, $user, $blogname ); 1997 2013 * 1998 * @param array $wp_new_user_notification_email_admin { 1999 * Used to build wp_mail(). 2014 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 2000 2015 * 2001 * @type string $to The intended recipient - site admin email address. 2002 * @type string $subject The subject of the email. 2003 * @type string $message The body of the email. 2004 * @type string $headers The headers of the email. 2005 * } 2006 * @param WP_User $user User object for new user. 2007 * @param string $blogname The site title. 2016 * apply_filters( 'wp_mailer', $mail, $caller_info ); 2017 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 2018 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 2019 * 2008 2020 */ 2009 $wp_new_user_notification_email_admin = apply_filters( 'wp_new_user_notification_email_admin', $wp_new_user_notification_email_admin, $user, $blogname );2010 2021 2011 wp_mail( 2012 $wp_new_user_notification_email_admin['to'], 2013 wp_specialchars_decode( sprintf( $wp_new_user_notification_email_admin['subject'], $blogname ) ), 2014 $wp_new_user_notification_email_admin['message'], 2015 $wp_new_user_notification_email_admin['headers'] 2022 $wp_mail = array( 2023 'id' => 'new_user_notification', 2024 'group' => 'admin', 2025 2026 'to' => get_option( 'admin_email' ), 2027 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2028 'subject' => __( '[{{SITENAME}}] New User Registration' ), 2029 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2030 'message' => __( 2031 '{{HEADER}} 2032 2033 New user registration on your site {{SITENAME}}: 2034 2035 Username: {{USERNAME}} 2036 2037 Email: {{EMAIL}} 2038 2039 {{FOOTER}}' 2040 ), 2041 'replacements' => array( 2042 '{{USERNAME}}' => $user->user_login, 2043 '{{EMAIL}}' => $user->user_email, 2044 ), 2016 2045 ); 2017 2046 2047 $wp_mailer = WP_Mailer::getInstance(); 2048 $wp_mailer->send( $wp_mail ); 2049 2018 2050 if ( $switched_locale ) { 2019 2051 restore_previous_locale(); 2020 2052 } … … 2031 2063 } 2032 2064 2033 2065 $switched_locale = switch_to_locale( get_user_locale( $user ) ); 2034 2035 /* translators: %s: User login. */ 2036 $message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n"; 2037 $message .= __( 'To set your password, visit the following address:' ) . "\r\n\r\n"; 2038 $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) . "\r\n\r\n"; 2039 2040 $message .= wp_login_url() . "\r\n"; 2041 2042 $wp_new_user_notification_email = array( 2043 'to' => $user->user_email, 2044 /* translators: Login details notification email subject. %s: Site title. */ 2045 'subject' => __( '[%s] Login Details' ), 2046 'message' => $message, 2047 'headers' => '', 2048 ); 2049 2066 2050 2067 /** 2051 * Filter s the contents of the new user notification email sent to the new user.2068 * Filter removed 2052 2069 * 2053 * @since 4.9.02070 * $wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email', $wp_new_user_notification_email, $user, $blogname ); 2054 2071 * 2055 * @param array $wp_new_user_notification_email { 2056 * Used to build wp_mail(). 2072 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 2057 2073 * 2058 * @type string $to The intended recipient - New user email address. 2059 * @type string $subject The subject of the email. 2060 * @type string $message The body of the email. 2061 * @type string $headers The headers of the email. 2062 * } 2063 * @param WP_User $user User object for new user. 2064 * @param string $blogname The site title. 2074 * apply_filters( 'wp_mailer', $mail, $caller_info ); 2075 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 2076 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 2077 * 2065 2078 */ 2066 $wp_new_user_notification_email = apply_filters( 'wp_new_user_notification_email', $wp_new_user_notification_email, $user, $blogname );2067 2079 2068 wp_mail( 2069 $wp_new_user_notification_email['to'], 2070 wp_specialchars_decode( sprintf( $wp_new_user_notification_email['subject'], $blogname ) ), 2071 $wp_new_user_notification_email['message'], 2072 $wp_new_user_notification_email['headers'] 2080 $wp_mail = array( 2081 'id' => 'new_user', 2082 'group' => 'blog', 2083 2084 'to' => $user->user_email, 2085 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2086 'subject' => __( '[{{SITENAME}}] Login Details' ), 2087 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2088 'message' => __( 2089 '{{HEADER}} 2090 2091 Username: {{USERNAME}} 2092 2093 To set your password, visit the following address: 2094 {{PASSWORDLINK}} 2095 2096 {{LOGINLINK}} 2097 2098 {{FOOTER}}' 2099 ), 2100 'replacements' => array( 2101 '{{USERNAME}}' => $user->user_login, 2102 '{{PASSWORDLINK}}' => esc_url_raw( network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user->user_login ), 'login' ) ), 2103 '{{LOGINLINK}}' => esc_url_raw( wp_login_url() ), 2104 ), 2073 2105 ); 2074 2106 2107 $wp_mailer = WP_Mailer::getInstance(); 2108 $wp_mailer->send( $wp_mail ); 2075 2109 if ( $switched_locale ) { 2076 2110 restore_previous_locale(); 2077 2111 } -
wp-includes/user.php
1996 1996 1997 1997 if ( ! is_wp_error( $user_id ) ) { 1998 1998 1999 $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );2000 2001 1999 $switched_locale = false; 2002 2000 if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) { 2003 2001 $switched_locale = switch_to_locale( get_user_locale( $user_id ) ); … … 2004 2002 } 2005 2003 2006 2004 if ( ! empty( $send_password_change_email ) ) { 2007 /* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */2008 $pass_change_text = __(2009 'Hi ###USERNAME###,2010 2005 2011 This notice confirms that your password was changed on ###SITENAME###. 2006 /** 2007 * Filter removed 2008 * 2009 * $pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata ); 2010 * 2011 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 2012 * 2013 * apply_filters( 'wp_mailer', $mail, $caller_info ); 2014 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 2015 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 2016 * 2017 */ 2012 2018 2019 $wp_mail = array( 2020 'id' => 'password_change', 2021 'group' => 'blog', 2022 2023 'to' => $user['user_email'], 2024 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2025 'subject' => __( '[{{SITENAME}}] Password Changed' ), 2026 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2027 'message' => __( 2028 '{{HEADER}} 2029 2030 As {{USERNAME}}, this notice confirms that your password was changed on {{SITENAME}}. 2031 2013 2032 If you did not change your password, please contact the Site Administrator at 2014 ###ADMIN_EMAIL### 2033 {{ADMIN_EMAIL}} 2015 2034 2016 This email has been sent to ###EMAIL###2035 This email has been sent to {{EMAIL}} 2017 2036 2018 Regards, 2019 All at ###SITENAME### 2020 ###SITEURL###' 2037 {{FOOTER}}' 2038 ), 2039 'replacements' => array( 2040 '{{USERNAME}}' => $user['user_login'], 2041 '{{ADMIN_EMAIL}}' => get_option( 'admin_email' ), 2042 '{{EMAIL}}' => $user['user_email'], 2043 ), 2021 2044 ); 2022 2045 2023 $pass_change_email = array( 2024 'to' => $user['user_email'], 2025 /* translators: Password change notification email subject. %s: Site title. */ 2026 'subject' => __( '[%s] Password Changed' ), 2027 'message' => $pass_change_text, 2028 'headers' => '', 2029 ); 2046 $wp_mailer = WP_Mailer::getInstance(); 2047 $wp_mailer->send( $wp_mail ); 2048 } 2030 2049 2050 if ( ! empty( $send_email_change_email ) ) { 2051 2031 2052 /** 2032 * Filters the contents of the email sent when the user's password is changed.2053 * Filters removed 2033 2054 * 2034 * @since 4.3.02055 * $email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata ); 2035 2056 * 2036 * @param array $pass_change_email { 2037 * Used to build wp_mail(). 2038 * @type string $to The intended recipients. Add emails in a comma separated string. 2039 * @type string $subject The subject of the email. 2040 * @type string $message The content of the email. 2041 * The following strings have a special meaning and will get replaced dynamically: 2042 * - ###USERNAME### The current user's username. 2043 * - ###ADMIN_EMAIL### The admin email in case this was unexpected. 2044 * - ###EMAIL### The user's email address. 2045 * - ###SITENAME### The name of the site. 2046 * - ###SITEURL### The URL to the site. 2047 * @type string $headers Headers. Add headers in a newline (\r\n) separated string. 2048 * } 2049 * @param array $user The original user array. 2050 * @param array $userdata The updated user array. 2057 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 2058 * 2059 * apply_filters( 'wp_mailer', $mail, $caller_info ); 2060 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 2061 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 2062 * 2051 2063 */ 2052 $pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata );2053 2064 2054 $pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] ); 2055 $pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] ); 2056 $pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] ); 2057 $pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] ); 2058 $pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] ); 2065 $wp_mail = array( 2066 'id' => 'email_change', 2067 'group' => 'blog', 2059 2068 2060 wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] ); 2061 } 2069 'to' => $user['user_email'], 2070 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2071 'subject' => __( '[{{SITENAME}}] Email Changed' ), 2072 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2073 'message' => __( 2074 '{{HEADER}} 2062 2075 2063 if ( ! empty( $send_email_change_email ) ) { 2064 /* translators: Do not translate USERNAME, ADMIN_EMAIL, NEW_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2065 $email_change_text = __( 2066 'Hi ###USERNAME###, 2076 As {{USERNAME}}, this notice confirms that your email address on {{SITENAME}} to {{NEW_EMAIL}}. 2067 2077 2068 This notice confirms that your email address on ###SITENAME### was changed to ###NEW_EMAIL###. 2078 If you did not change your password, please contact the Site Administrator at 2079 {{ADMIN_EMAIL}} 2069 2080 2070 If you did not change your email, please contact the Site Administrator at 2071 ###ADMIN_EMAIL### 2081 This email has been sent to {{EMAIL}} 2072 2082 2073 This email has been sent to ###EMAIL### 2074 2075 Regards, 2076 All at ###SITENAME### 2077 ###SITEURL###' 2083 {{FOOTER}}' 2084 ), 2085 'replacements' => array( 2086 '{{USERNAME}}' => $user['user_login'], 2087 '{{ADMIN_EMAIL}}' => get_option( 'admin_email' ), 2088 '{{EMAIL}}' => $user['user_email'], 2089 '{{NEW_EMAIL}}' => $userdata['user_email'], 2090 ), 2078 2091 ); 2079 2092 2080 $email_change_email = array( 2081 'to' => $user['user_email'], 2082 /* translators: Email change notification email subject. %s: Site title. */ 2083 'subject' => __( '[%s] Email Changed' ), 2084 'message' => $email_change_text, 2085 'headers' => '', 2086 ); 2087 2088 /** 2089 * Filters the contents of the email sent when the user's email is changed. 2090 * 2091 * @since 4.3.0 2092 * 2093 * @param array $email_change_email { 2094 * Used to build wp_mail(). 2095 * @type string $to The intended recipients. 2096 * @type string $subject The subject of the email. 2097 * @type string $message The content of the email. 2098 * The following strings have a special meaning and will get replaced dynamically: 2099 * - ###USERNAME### The current user's username. 2100 * - ###ADMIN_EMAIL### The admin email in case this was unexpected. 2101 * - ###NEW_EMAIL### The new email address. 2102 * - ###EMAIL### The old email address. 2103 * - ###SITENAME### The name of the site. 2104 * - ###SITEURL### The URL to the site. 2105 * @type string $headers Headers. 2106 * } 2107 * @param array $user The original user array. 2108 * @param array $userdata The updated user array. 2109 */ 2110 $email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata ); 2111 2112 $email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] ); 2113 $email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] ); 2114 $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_change_email['message'] ); 2115 $email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] ); 2116 $email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] ); 2117 $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); 2118 2119 wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] ); 2093 $wp_mailer = WP_Mailer::getInstance(); 2094 $wp_mailer->send( $wp_mail ); 2120 2095 } 2121 2096 2122 2097 if ( $switched_locale ) { … … 2829 2804 ); 2830 2805 update_user_meta( $current_user->ID, '_new_email', $new_user_email ); 2831 2806 2832 $sitename = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 2807 /** 2808 * Filters removed 2809 * 2810 * $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email ); 2811 * 2812 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 2813 * 2814 * apply_filters( 'wp_mailer', $mail, $caller_info ); 2815 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 2816 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 2817 * 2818 */ 2833 2819 2834 /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */2835 $email_text = __(2836 ' Howdy ###USERNAME###,2820 $wp_mail = array( 2821 'id' => 'new_user_email', 2822 'group' => 'blog', 2837 2823 2838 You recently requested to have the email address on your account changed. 2824 'to' => $_POST['email'], 2825 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2826 'subject' => __( '[{{SITENAME}}] Email Change Request' ), 2827 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 2828 'message' => __( 2829 '{{HEADER}} 2839 2830 2831 As {{USERNAME}}, you recently requested to have the email address on your account changed. 2832 2840 2833 If this is correct, please click on the following link to change it: 2841 ###ADMIN_URL### 2834 {{ADMIN_URL}} 2842 2835 2843 2836 You can safely ignore and delete this email if you do not want to 2844 2837 take this action. 2845 2838 2846 This email has been sent to ###EMAIL###2839 This email has been sent to {{EMAIL}} 2847 2840 2848 Regards, 2849 All at ###SITENAME### 2850 ###SITEURL###' 2841 {{FOOTER}}' 2842 ), 2843 'replacements' => array( 2844 '{{USERNAME}}' => $current_user->user_login, 2845 '{{ADMIN_URL}}' => esc_url_raw( admin_url( 'profile.php?newuseremail=' . $hash ) ), 2846 '{{EMAIL}}' => $_POST['email'], 2847 ), 2851 2848 ); 2852 2849 2853 /** 2854 * Filters the text of the email sent when a change of user email address is attempted. 2855 * 2856 * The following strings have a special meaning and will get replaced dynamically: 2857 * ###USERNAME### The current user's username. 2858 * ###ADMIN_URL### The link to click on to confirm the email change. 2859 * ###EMAIL### The new email. 2860 * ###SITENAME### The name of the site. 2861 * ###SITEURL### The URL to the site. 2862 * 2863 * @since MU (3.0.0) 2864 * @since 4.9.0 This filter is no longer Multisite specific. 2865 * 2866 * @param string $email_text Text in the email. 2867 * @param array $new_user_email { 2868 * Data relating to the new user email address. 2869 * 2870 * @type string $hash The secure hash used in the confirmation link URL. 2871 * @type string $newemail The proposed new email address. 2872 * } 2873 */ 2874 $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email ); 2850 $wp_mailer = WP_Mailer::getInstance(); 2851 $wp_mailer->send( $wp_mail ); 2875 2852 2876 $content = str_replace( '###USERNAME###', $current_user->user_login, $content );2877 $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail=' . $hash ) ), $content );2878 $content = str_replace( '###EMAIL###', $_POST['email'], $content );2879 $content = str_replace( '###SITENAME###', $sitename, $content );2880 $content = str_replace( '###SITEURL###', home_url(), $content );2881 2882 /* translators: New email address notification email subject. %s: Site title. */2883 wp_mail( $_POST['email'], sprintf( __( '[%s] Email Change Request' ), $sitename ), $content );2884 2885 2853 $_POST['email'] = $current_user->user_email; 2886 2854 } 2887 2855 } … … 3188 3156 return; 3189 3157 } 3190 3158 3159 $manage_url = ''; 3191 3160 if ( 'export_personal_data' === $request->action_name ) { 3192 3161 $manage_url = admin_url( 'export-personal-data.php' ); 3193 3162 } elseif ( 'remove_personal_data' === $request->action_name ) { … … 3196 3165 $action_description = wp_user_request_action_description( $request->action_name ); 3197 3166 3198 3167 /** 3199 * Filters the recipient of the data request confirmation notification.3168 * Filters removed 3200 3169 * 3201 * In a Multisite environment, this will default to the email address of the 3202 * network admin because, by default, single site admins do not have the 3203 * capabilities required to process requests. Some networks may wish to 3204 * delegate those capabilities to a single-site admin, or a dedicated person 3205 * responsible for managing privacy requests. 3170 * $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request ); 3171 * $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data ); 3172 * $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data ); 3173 * $headers = apply_filters( 'user_request_confirmed_email_headers', $headers, $subject, $content, $request_id, $email_data ); 3206 3174 * 3207 * @since 4.9.63175 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 3208 3176 * 3209 * @param string $admin_email The email address of the notification recipient. 3210 * @param WP_User_Request $request The request that is initiating the notification. 3177 * apply_filters( 'wp_mailer', $mail, $caller_info ); 3178 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 3179 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 3180 * 3211 3181 */ 3212 $admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request );3213 3182 3214 $email_data = array( 3215 'request' => $request, 3216 'user_email' => $request->email, 3217 'description' => $action_description, 3218 'manage_url' => $manage_url, 3219 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 3220 'siteurl' => home_url(), 3221 'admin_email' => $admin_email, 3222 ); 3183 $wp_mail = array( 3184 'id' => 'user_request_confirmed_email', 3185 'group' => 'privacy', 3223 3186 3224 /* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */ 3225 $email_text = __( 3226 'Howdy, 3187 'to' => get_site_option( 'admin_email' ), 3188 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 3189 'subject' => __( '[{{SITENAME}}] Action Confirmed: {{ACTION_NAME}}' ), 3190 'message' => __( 3191 '{{HEADER}} 3227 3192 3228 A user data privacy request has been confirmed on ###SITENAME###:3193 A user data privacy request has been confirmed on {{SITENAME}}: 3229 3194 3230 User: ###USER_EMAIL###3231 Request: ###DESCRIPTION###3195 User: {{EMAIL}} 3196 Request: {{ACTION_NAME}} 3232 3197 3233 3198 You can view and manage these data privacy requests here: 3234 3199 3235 ###MANAGE_URL### 3200 {{ADMIN_URL}} 3236 3201 3237 Regards, 3238 All at ###SITENAME### 3239 ###SITEURL###' 3202 {{FOOTER}}' 3203 ), 3204 'replacements' => array( 3205 '{{EMAIL}}' => $request->email, 3206 '{{ACTION_NAME}}' => wp_user_request_action_description( $request->action_name ), 3207 '{{ADMIN_URL}}' => esc_url_raw( $manage_url ), 3208 ), 3240 3209 ); 3241 3210 3242 /** 3243 * Filters the body of the user request confirmation email. 3244 * 3245 * The email is sent to an administrator when an user request is confirmed. 3246 * The following strings have a special meaning and will get replaced dynamically: 3247 * 3248 * ###SITENAME### The name of the site. 3249 * ###USER_EMAIL### The user email for the request. 3250 * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for. 3251 * ###MANAGE_URL### The URL to manage requests. 3252 * ###SITEURL### The URL to the site. 3253 * 3254 * @since 4.9.6 3255 * 3256 * @param string $email_text Text in the email. 3257 * @param array $email_data { 3258 * Data relating to the account action email. 3259 * 3260 * @type WP_User_Request $request User request object. 3261 * @type string $user_email The email address confirming a request 3262 * @type string $description Description of the action being performed so the user knows what the email is for. 3263 * @type string $manage_url The link to click manage privacy requests of this type. 3264 * @type string $sitename The site name sending the mail. 3265 * @type string $siteurl The site URL sending the mail. 3266 * @type string $admin_email The administrator email receiving the mail. 3267 * } 3268 */ 3269 $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data ); 3211 $wp_mailer = WP_Mailer::getInstance(); 3212 $email_sent = $wp_mailer->send( $wp_mail ); 3270 3213 3271 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );3272 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );3273 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );3274 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );3275 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );3276 3277 $subject = sprintf(3278 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */3279 __( '[%1$s] Action Confirmed: %2$s' ),3280 $email_data['sitename'],3281 $action_description3282 );3283 3284 /**3285 * Filters the subject of the user request confirmation email.3286 *3287 * @since 4.9.83288 *3289 * @param string $subject The email subject.3290 * @param string $sitename The name of the site.3291 * @param array $email_data {3292 * Data relating to the account action email.3293 *3294 * @type WP_User_Request $request User request object.3295 * @type string $user_email The email address confirming a request3296 * @type string $description Description of the action being performed so the user knows what the email is for.3297 * @type string $manage_url The link to click manage privacy requests of this type.3298 * @type string $sitename The site name sending the mail.3299 * @type string $siteurl The site URL sending the mail.3300 * @type string $admin_email The administrator email receiving the mail.3301 * }3302 */3303 $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );3304 3305 $headers = '';3306 3307 /**3308 * Filters the headers of the user request confirmation email.3309 *3310 * @since 5.4.03311 *3312 * @param string|array $headers The email headers.3313 * @param string $subject The email subject.3314 * @param string $content The email content.3315 * @param int $request_id The request ID.3316 * @param array $email_data {3317 * Data relating to the account action email.3318 *3319 * @type WP_User_Request $request User request object.3320 * @type string $user_email The email address confirming a request3321 * @type string $description Description of the action being performed so the user knows what the email is for.3322 * @type string $manage_url The link to click manage privacy requests of this type.3323 * @type string $sitename The site name sending the mail.3324 * @type string $siteurl The site URL sending the mail.3325 * @type string $admin_email The administrator email receiving the mail.3326 * }3327 */3328 $headers = apply_filters( 'user_request_confirmed_email_headers', $headers, $subject, $content, $request_id, $email_data );3329 3330 $email_sent = wp_mail( $email_data['admin_email'], $subject, $content, $headers );3331 3332 3214 if ( $email_sent ) { 3333 3215 update_post_meta( $request_id, '_wp_admin_notified', true ); 3334 3216 } … … 3356 3238 return; 3357 3239 } 3358 3240 3241 $privacy_policy_url = get_privacy_policy_url(); 3242 3359 3243 // Localize message content for user; fallback to site default for visitors. 3360 3244 if ( ! empty( $request->user_id ) ) { 3361 3245 $locale = get_user_locale( $request->user_id ); … … 3366 3250 $switched_locale = switch_to_locale( $locale ); 3367 3251 3368 3252 /** 3369 * Filters the recipient of the data erasure fulfillment notification.3253 * Filters removed 3370 3254 * 3371 * @since 4.9.6 3255 * $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request ); 3256 * $subject = apply_filters( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data ); 3257 * $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data ); 3258 * $headers = apply_filters( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data ); 3372 3259 * 3373 * @param string $user_email The email address of the notification recipient. 3374 * @param WP_User_Request $request The request that is initiating the notification. 3375 */ 3376 $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request ); 3377 3378 $email_data = array( 3379 'request' => $request, 3380 'message_recipient' => $user_email, 3381 'privacy_policy_url' => get_privacy_policy_url(), 3382 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 3383 'siteurl' => home_url(), 3384 ); 3385 3386 $subject = sprintf( 3387 /* translators: Erasure request fulfilled notification email subject. %s: Site title. */ 3388 __( '[%s] Erasure Request Fulfilled' ), 3389 $email_data['sitename'] 3390 ); 3391 3392 /** 3393 * Filters the subject of the email sent when an erasure request is completed. 3260 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 3394 3261 * 3395 * @since 4.9.8 3262 * apply_filters( 'wp_mailer', $mail, $caller_info ); 3263 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 3264 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 3396 3265 * 3397 * @param string $subject The email subject.3398 * @param string $sitename The name of the site.3399 * @param array $email_data {3400 * Data relating to the account action email.3401 *3402 * @type WP_User_Request $request User request object.3403 * @type string $message_recipient The address that the email will be sent to. Defaults3404 * to the value of `$request->email`, but can be changed3405 * by the `user_erasure_fulfillment_email_to` filter.3406 * @type string $privacy_policy_url Privacy policy URL.3407 * @type string $sitename The site name sending the mail.3408 * @type string $siteurl The site URL sending the mail.3409 * }3410 3266 */ 3411 $subject = apply_filters( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data );3412 3267 3413 if ( empty( $email_data['privacy_policy_url'] ) ) {3414 /* translators: Do not translate SITENAME, SITEURL; those areplaceholders. */3415 $email_text= __(3416 'Howdy, 3268 $notify_message = array(); 3269 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 3270 $notify_message[] = __( 3271 '{{HEADER}} 3417 3272 3418 Your request to erase your personal data on ###SITENAME###has been completed.3273 Your request to erase your personal data on {{SITENAME}} has been completed. 3419 3274 3420 If you have any follow-up questions or concerns, please contact the site administrator. 3275 If you have any follow-up questions or concerns, please contact the site administrator.' 3276 ); 3421 3277 3422 Regards, 3423 All at ###SITENAME### 3424 ###SITEURL###' 3425 ); 3426 } else { 3427 /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */ 3428 $email_text = __( 3429 'Howdy, 3430 3431 Your request to erase your personal data on ###SITENAME### has been completed. 3432 3433 If you have any follow-up questions or concerns, please contact the site administrator. 3434 3435 For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL### 3436 3437 Regards, 3438 All at ###SITENAME### 3439 ###SITEURL###' 3440 ); 3278 if ( !empty( $privacy_policy_url ) ) { 3279 $notify_message[] = ''; 3280 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 3281 $notify_message[] = __( 'For more information, you can also read our privacy policy: {{PRIVACY_POLICY_URL}}' ); 3441 3282 } 3442 3283 3443 /** 3444 * Filters the body of the data erasure fulfillment notification. 3445 * 3446 * The email is sent to a user when a their data erasure request is fulfilled 3447 * by an administrator. 3448 * 3449 * The following strings have a special meaning and will get replaced dynamically: 3450 * 3451 * ###SITENAME### The name of the site. 3452 * ###PRIVACY_POLICY_URL### Privacy policy page URL. 3453 * ###SITEURL### The URL to the site. 3454 * 3455 * @since 4.9.6 3456 * 3457 * @param string $email_text Text in the email. 3458 * @param array $email_data { 3459 * Data relating to the account action email. 3460 * 3461 * @type WP_User_Request $request User request object. 3462 * @type string $message_recipient The address that the email will be sent to. Defaults 3463 * to the value of `$request->email`, but can be changed 3464 * by the `user_erasure_fulfillment_email_to` filter. 3465 * @type string $privacy_policy_url Privacy policy URL. 3466 * @type string $sitename The site name sending the mail. 3467 * @type string $siteurl The site URL sending the mail. 3468 * } 3469 */ 3470 $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data ); 3284 $notify_message[] = ''; 3285 $notify_message[] = '{{FOOTER}}'; 3471 3286 3472 $ content = str_replace( '###SITENAME###', $email_data['sitename'], $content );3473 $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content );3474 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );3287 $wp_mail = array( 3288 'id' => 'user_erasure_complete_email', 3289 'group' => 'privacy', 3475 3290 3476 $headers = ''; 3291 'to' => $request->email, 3292 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 3293 'subject' => __( '[{{SITENAME}}] Erasure Request Fulfilled' ), 3294 'message' => implode( "\r\n", $notify_message ), 3295 'replacements' => array( 3296 '{{PRIVACY_POLICY_URL}}' => esc_url_raw( $privacy_policy_url ) 3297 ), 3298 ); 3477 3299 3478 /** 3479 * Filters the headers of the data erasure fulfillment notification. 3480 * 3481 * @since 5.4.0 3482 * 3483 * @param string|array $headers The email headers. 3484 * @param string $subject The email subject. 3485 * @param string $content The email content. 3486 * @param int $request_id The request ID. 3487 * @param array $email_data { 3488 * Data relating to the account action email. 3489 * 3490 * @type WP_User_Request $request User request object. 3491 * @type string $message_recipient The address that the email will be sent to. Defaults 3492 * to the value of `$request->email`, but can be changed 3493 * by the `user_erasure_fulfillment_email_to` filter. 3494 * @type string $privacy_policy_url Privacy policy URL. 3495 * @type string $sitename The site name sending the mail. 3496 * @type string $siteurl The site URL sending the mail. 3497 * } 3498 */ 3499 $headers = apply_filters( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data ); 3300 $wp_mailer = WP_Mailer::getInstance(); 3301 $email_sent = $wp_mailer->send( $wp_mail ); 3500 3302 3501 $email_sent = wp_mail( $user_email, $subject, $content, $headers );3502 3503 3303 if ( $switched_locale ) { 3504 3304 restore_previous_locale(); 3505 3305 } … … 3661 3461 return new WP_Error( 'invalid_request', __( 'Invalid user request.' ) ); 3662 3462 } 3663 3463 3664 // Localize message content for user; fallback to site default for visitors. 3665 if ( ! empty( $request->user_id ) ) { 3666 $locale = get_user_locale( $request->user_id ); 3667 } else { 3668 $locale = get_locale(); 3669 } 3670 3671 $switched_locale = switch_to_locale( $locale ); 3672 3673 $email_data = array( 3674 'request' => $request, 3675 'email' => $request->email, 3676 'description' => wp_user_request_action_description( $request->action_name ), 3677 'confirm_url' => add_query_arg( 3464 $confirm_url = add_query_arg( 3678 3465 array( 3679 3466 'action' => 'confirmaction', 3680 3467 'request_id' => $request_id, … … 3681 3468 'confirm_key' => wp_generate_user_request_key( $request_id ), 3682 3469 ), 3683 3470 wp_login_url() 3684 ),3685 'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),3686 'siteurl' => home_url(),3687 3471 ); 3688 3472 3689 /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */ 3690 $email_text = __( 3691 'Howdy, 3473 $is_privacy = ( in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ); 3692 3474 3693 A request has been made to perform the following action on your account: 3475 // Localize message content for user; fallback to site default for visitors. 3476 if ( ! empty( $request->user_id ) ) { 3477 $locale = get_user_locale( $request->user_id ); 3478 } else { 3479 $locale = get_locale(); 3480 } 3694 3481 3695 ###DESCRIPTION### 3696 3697 To confirm this, please click on the following link: 3698 ###CONFIRM_URL### 3699 3700 You can safely ignore and delete this email if you do not want to 3701 take this action. 3702 3703 Regards, 3704 All at ###SITENAME### 3705 ###SITEURL###' 3706 ); 3707 3482 $switched_locale = switch_to_locale( $locale ); 3483 3708 3484 /** 3709 * Filters the text of the email sent when an account action is attempted.3485 * Filters removed 3710 3486 * 3711 * The following strings have a special meaning and will get replaced dynamically: 3487 * $content = apply_filters( 'user_request_action_email_content', $email_text, $email_data ); 3488 * $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); 3489 * $headers = apply_filters( 'user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data ); 3712 3490 * 3713 * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for. 3714 * ###CONFIRM_URL### The link to click on to confirm the account action. 3715 * ###SITENAME### The name of the site. 3716 * ###SITEURL### The URL to the site. 3491 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 3717 3492 * 3718 * @since 4.9.6 3493 * apply_filters( 'wp_mailer', $mail, $caller_info ); 3494 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 3495 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 3719 3496 * 3720 * @param string $email_text Text in the email.3721 * @param array $email_data {3722 * Data relating to the account action email.3723 *3724 * @type WP_User_Request $request User request object.3725 * @type string $email The email address this is being sent to.3726 * @type string $description Description of the action being performed so the user knows what the email is for.3727 * @type string $confirm_url The link to click on to confirm the account action.3728 * @type string $sitename The site name sending the mail.3729 * @type string $siteurl The site URL sending the mail.3730 * }3731 3497 */ 3732 $content = apply_filters( 'user_request_action_email_content', $email_text, $email_data );3733 3498 3734 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 3735 $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content ); 3736 $content = str_replace( '###EMAIL###', $email_data['email'], $content ); 3737 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3738 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 3499 $wp_mail = array( 3500 'id' => 'user_request_action_email', 3501 'group' => ( $is_privacy ) ? 'privacy' : 'blog', 3739 3502 3740 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */ 3741 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] ); 3503 'to' => $request->email, 3504 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 3505 'subject' => __( '[{{SITENAME}}] Confirm Action: {{ACTION_NAME}}' ), 3506 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 3507 'message' => __( 3508 '{{HEADER}} 3742 3509 3743 /** 3744 * Filters the subject of the email sent when an account action is attempted. 3745 * 3746 * @since 4.9.6 3747 * 3748 * @param string $subject The email subject. 3749 * @param string $sitename The name of the site. 3750 * @param array $email_data { 3751 * Data relating to the account action email. 3752 * 3753 * @type WP_User_Request $request User request object. 3754 * @type string $email The email address this is being sent to. 3755 * @type string $description Description of the action being performed so the user knows what the email is for. 3756 * @type string $confirm_url The link to click on to confirm the account action. 3757 * @type string $sitename The site name sending the mail. 3758 * @type string $siteurl The site URL sending the mail. 3759 * } 3760 */ 3761 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); 3510 A request has been made to perform the following action on your account: 3762 3511 3763 $headers = ''; 3512 {{ACTION_NAME}} 3764 3513 3765 /** 3766 * Filters the headers of the email sent when an account action is attempted. 3767 * 3768 * @since 5.4.0 3769 * 3770 * @param string|array $headers The email headers. 3771 * @param string $subject The email subject. 3772 * @param string $content The email content. 3773 * @param int $request_id The request ID. 3774 * @param array $email_data { 3775 * Data relating to the account action email. 3776 * 3777 * @type WP_User_Request $request User request object. 3778 * @type string $email The email address this is being sent to. 3779 * @type string $description Description of the action being performed so the user knows what the email is for. 3780 * @type string $confirm_url The link to click on to confirm the account action. 3781 * @type string $sitename The site name sending the mail. 3782 * @type string $siteurl The site URL sending the mail. 3783 * } 3784 */ 3785 $headers = apply_filters( 'user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data ); 3514 To confirm this, please click on the following link: 3515 {{LOGINLINK}} 3786 3516 3787 $email_sent = wp_mail( $email_data['email'], $subject, $content, $headers ); 3517 You can safely ignore and delete this email if you do not want to 3518 take this action. 3788 3519 3520 {{FOOTER}}' 3521 ), 3522 'replacements' => array( 3523 '{{ACTION_NAME}}' => wp_user_request_action_description( $request->action_name ), 3524 '{{LOGINLINK}}' => esc_url_raw( $confirm_url ), 3525 ), 3526 ); 3527 3528 $wp_mailer = WP_Mailer::getInstance(); 3529 $email_sent = $wp_mailer->send( $wp_mail ); 3530 3789 3531 if ( $switched_locale ) { 3790 3532 restore_previous_locale(); 3791 3533 } -
wp-login.php
415 415 $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 416 416 } 417 417 418 $message = __( 'Someone has requested a password reset for the following account:' ) . "\r\n\r\n";419 /* translators: %s: Site name. */420 $message .= sprintf( __( 'Site Name: %s' ), $site_name ) . "\r\n\r\n";421 /* translators: %s: User login. */422 $message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n";423 $message .= __( 'If this was a mistake, just ignore this email and nothing will happen.' ) . "\r\n\r\n";424 $message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n";425 $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . "\r\n";426 427 /* translators: Password reset notification email subject. %s: Site title. */428 $title = sprintf( __( '[%s] Password Reset' ), $site_name );429 430 418 /** 431 * Filters the subject of the password reset email.419 * Filters removed 432 420 * 433 * @since 2.8.0434 * @since 4.4.0 Added the `$user_login` and `$user_data` parameters.421 * $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data ); 422 * $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); 435 423 * 436 * @param string $title Default email title. 437 * @param string $user_login The username for the user. 438 * @param WP_User $user_data WP_User object. 439 */ 440 $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data ); 441 442 /** 443 * Filters the message body of the password reset mail. 424 * all mails components are filterable using wp-includes/class-wp-mailer.php filters 444 425 * 445 * If the filtered message is empty, the password reset email will not be sent. 426 * apply_filters( 'wp_mailer', $mail, $caller_info ); 427 * apply_filters( "wp_mailer_group_{$mail['group']}", $mail, $caller_info ); 428 * apply_filters( "wp_mailer_{$mail['id']}", $mail, $caller_info ); 446 429 * 447 * @since 2.8.0448 * @since 4.1.0 Added `$user_login` and `$user_data` parameters.449 *450 * @param string $message Default mail message.451 * @param string $key The activation key.452 * @param string $user_login The username for the user.453 * @param WP_User $user_data WP_User object.454 430 */ 455 $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );456 431 457 if ( $message && ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) { 432 $wp_mail = array( 433 'id' => 'retrieve_password', 434 'group' => 'blog', 435 436 'to' => $user_email, 437 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 438 'subject' => __( '[{{SITENAME}}] Password Reset' ), 439 /* translators: Do not translate any string between double curled brackets {{STRING}} : those are "mustache" placeholders. */ 440 'message' => __( 441 '{{HEADER}} 442 443 Someone has requested a password reset for the following account: 444 445 Site Name: {{SITENAME}} 446 447 Username: {{USERNAME}} 448 449 If this was a mistake, just ignore this email and nothing will happen. 450 451 To reset your password, visit the following address: 452 453 {{RESETLINK}} 454 455 {{FOOTER}}' 456 ), 457 'replacements' => array( 458 '{{SITENAME}}' => $site_name, 459 '{{USERNAME}}' => $user_login, 460 '{{RESETLINK}}' => esc_url_raw( network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) ) 461 ), 462 ); 463 464 $wp_mailer = WP_Mailer::getInstance(); 465 if ( ! $wp_mailer->send( $wp_mail ) ) { 458 466 $errors->add( 459 467 'retrieve_password_email_failure', 460 468 sprintf( -
wp-settings.php
281 281 require ABSPATH . WPINC . '/blocks/shortcode.php'; 282 282 require ABSPATH . WPINC . '/blocks/social-link.php'; 283 283 require ABSPATH . WPINC . '/blocks/tag-cloud.php'; 284 require ABSPATH . WPINC . '/class-wp-mailer.php'; 284 285 286 285 287 $GLOBALS['wp_embed'] = new WP_Embed(); 286 288 287 289 // Load multisite-specific files.