Mail: Replace empty site title with domain name in email subjects.

This change replaces site title with domain name in email subjects when the `blogname` option is empty.

Props Presskopp, kebbet, audrasjb, azouamauriac.
Fixes #54760.

Built from https://develop.svn.wordpress.org/trunk@53063


git-svn-id: http://core.svn.wordpress.org/trunk@52652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-04-04 20:21:00 +00:00
parent b8bc65042a
commit 267ebcec09
5 changed files with 34 additions and 6 deletions

View File

@ -1236,9 +1236,15 @@ class WP_Automatic_Updater {
$body[] = __( 'https://wordpress.org/support/forums/' );
$body[] = "\n" . __( 'The WordPress Team' );
if ( '' !== get_option( 'blogname' ) ) {
$site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
} else {
$site_title = parse_url( home_url(), PHP_URL_HOST );
}
$body = implode( "\n", $body );
$to = get_site_option( 'admin_email' );
$subject = sprintf( $subject, wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) );
$subject = sprintf( $subject, $site_title );
$headers = '';
$email = compact( 'to', 'subject', 'body', 'headers' );
@ -1347,7 +1353,11 @@ class WP_Automatic_Updater {
$body[] = '';
}
if ( '' !== get_bloginfo( 'name' ) ) {
$site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
} else {
$site_title = parse_url( home_url(), PHP_URL_HOST );
}
if ( $failures ) {
$body[] = trim(

View File

@ -1472,12 +1472,18 @@ All at ###SITENAME###
$content = str_replace( '###SITENAME###', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $content );
$content = str_replace( '###SITEURL###', home_url(), $content );
if ( '' !== get_option( 'blogname' ) ) {
$site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
} else {
$site_title = parse_url( home_url(), PHP_URL_HOST );
}
wp_mail(
$value,
sprintf(
/* translators: New admin email address notification email subject. %s: Site title. */
__( '[%s] New Admin Email Address' ),
wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES )
$site_title
),
$content
);

View File

@ -578,6 +578,12 @@ function admin_created_user_email( $text ) {
$roles = get_editable_roles();
$role = $roles[ $_REQUEST['role'] ];
if ( '' !== get_bloginfo( 'name' ) ) {
$site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
} else {
$site_title = parse_url( home_url(), PHP_URL_HOST );
}
return sprintf(
/* translators: 1: Site title, 2: Site URL, 3: User role. */
__(
@ -590,7 +596,7 @@ this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
%%s'
),
wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ),
$site_title,
home_url(),
wp_specialchars_decode( translate_user_role( $role['name'] ) )
);

View File

@ -112,6 +112,12 @@ if ( isset( $_REQUEST['action'] ) && 'adduser' === $_REQUEST['action'] ) {
$switched_locale = switch_to_locale( get_user_locale( $user_details ) );
if ( '' !== get_option( 'blogname' ) ) {
$site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
} else {
$site_title = parse_url( home_url(), PHP_URL_HOST );
}
/* translators: 1: Site title, 2: Site URL, 3: User role, 4: Activation URL. */
$message = __(
'Hi,
@ -127,7 +133,7 @@ Please click the following link to confirm the invite:
$new_user_email['subject'] = sprintf(
/* translators: Joining confirmation notification email subject. %s: Site title. */
__( '[%s] Joining Confirmation' ),
wp_specialchars_decode( get_option( 'blogname' ) )
$site_title
);
$new_user_email['message'] = sprintf(
$message,

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-53062';
$wp_version = '6.0-alpha-53063';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.