From 4a6f90db58a935abb688cfb91b391dffeda7b35c Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 26 Sep 2016 18:39:32 +0000 Subject: [PATCH] Multisite: Allow to set the site language of a new site to English. An empty string in `WPLANG` is used to define the site language as `en_US`. The `! empty()` check didn't catch this case so that `wpmu_create_blog()` fell back to the network setting. Fixes #36918. Built from https://develop.svn.wordpress.org/trunk@38655 git-svn-id: http://core.svn.wordpress.org/trunk@38598 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/network/site-new.php | 12 ++++++++---- wp-includes/ms-functions.php | 6 ++++-- wp-includes/version.php | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/wp-admin/network/site-new.php b/wp-admin/network/site-new.php index 7882d0e37886..4dd36392d414 100644 --- a/wp-admin/network/site-new.php +++ b/wp-admin/network/site-new.php @@ -65,10 +65,14 @@ ); // Handle translation install for the new site. - if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { - $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); - if ( $language ) { - $meta['WPLANG'] = $language; + if ( isset( $_POST['WPLANG'] ) ) { + if ( '' === $_POST['WPLANG'] ) { + $meta['WPLANG'] = ''; // en_US + } elseif ( wp_can_install_language_pack() ) { + $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); + if ( $language ) { + $meta['WPLANG'] = $language; + } } } diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 113f37f284fd..ca8176124f91 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -1092,7 +1092,10 @@ function wpmu_create_user( $user_name, $password, $email ) { * @return int|WP_Error Returns WP_Error object on failure, int $blog_id on success */ function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $site_id = 1 ) { - $defaults = array( 'public' => 0 ); + $defaults = array( + 'public' => 0, + 'WPLANG' => get_site_option( 'WPLANG' ), + ); $meta = wp_parse_args( $meta, $defaults ); $domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) ); @@ -1130,7 +1133,6 @@ function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $s update_option( $key, $value ); } - add_option( 'WPLANG', get_site_option( 'WPLANG' ) ); update_option( 'blog_public', (int) $meta['public'] ); if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) ) diff --git a/wp-includes/version.php b/wp-includes/version.php index 290a2189f86e..8af91b35b032 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38654'; +$wp_version = '4.7-alpha-38655'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.