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
This commit is contained in:
parent
a1ef815d04
commit
4a6f90db58
|
@ -65,12 +65,16 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Handle translation install for the new site.
|
// Handle translation install for the new site.
|
||||||
if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) {
|
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'] ) );
|
$language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
|
||||||
if ( $language ) {
|
if ( $language ) {
|
||||||
$meta['WPLANG'] = $language;
|
$meta['WPLANG'] = $language;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( empty( $domain ) )
|
if ( empty( $domain ) )
|
||||||
wp_die( __( 'Missing or invalid site address.' ) );
|
wp_die( __( 'Missing or invalid site address.' ) );
|
||||||
|
|
|
@ -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
|
* @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 ) {
|
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 );
|
$meta = wp_parse_args( $meta, $defaults );
|
||||||
|
|
||||||
$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
|
$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 );
|
update_option( $key, $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
|
|
||||||
update_option( 'blog_public', (int) $meta['public'] );
|
update_option( 'blog_public', (int) $meta['public'] );
|
||||||
|
|
||||||
if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
|
if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue