Users: When creating the first user on installation, populate the Website profile field with the site URL.
Skip setting the field if the user already exists, which is the case when the user tables are being shared among multiple sites. Props EFAREM, eclare, darrenlambert, zachflauaus, viralsampat. Fixes #35778. Built from https://develop.svn.wordpress.org/trunk@46989 git-svn-id: http://core.svn.wordpress.org/trunk@46789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
694913d65f
commit
4edec193bc
|
@ -82,16 +82,20 @@ if ( ! function_exists( 'wp_install' ) ) :
|
||||||
$user_id = username_exists( $user_name );
|
$user_id = username_exists( $user_name );
|
||||||
$user_password = trim( $user_password );
|
$user_password = trim( $user_password );
|
||||||
$email_password = false;
|
$email_password = false;
|
||||||
|
$user_created = false;
|
||||||
|
|
||||||
if ( ! $user_id && empty( $user_password ) ) {
|
if ( ! $user_id && empty( $user_password ) ) {
|
||||||
$user_password = wp_generate_password( 12, false );
|
$user_password = wp_generate_password( 12, false );
|
||||||
$message = __( '<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.' );
|
$message = __( '<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.' );
|
||||||
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
||||||
update_user_option( $user_id, 'default_password_nag', true, true );
|
update_user_option( $user_id, 'default_password_nag', true, true );
|
||||||
$email_password = true;
|
$email_password = true;
|
||||||
|
$user_created = true;
|
||||||
} elseif ( ! $user_id ) {
|
} elseif ( ! $user_id ) {
|
||||||
// Password has been provided
|
// Password has been provided.
|
||||||
$message = '<em>' . __( 'Your chosen password.' ) . '</em>';
|
$message = '<em>' . __( 'Your chosen password.' ) . '</em>';
|
||||||
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
||||||
|
$user_created = true;
|
||||||
} else {
|
} else {
|
||||||
$message = __( 'User already exists. Password inherited.' );
|
$message = __( 'User already exists. Password inherited.' );
|
||||||
}
|
}
|
||||||
|
@ -99,6 +103,11 @@ if ( ! function_exists( 'wp_install' ) ) :
|
||||||
$user = new WP_User( $user_id );
|
$user = new WP_User( $user_id );
|
||||||
$user->set_role( 'administrator' );
|
$user->set_role( 'administrator' );
|
||||||
|
|
||||||
|
if ( $user_created ) {
|
||||||
|
$user->user_url = $guessurl;
|
||||||
|
wp_update_user( $user );
|
||||||
|
}
|
||||||
|
|
||||||
wp_install_defaults( $user_id );
|
wp_install_defaults( $user_id );
|
||||||
|
|
||||||
wp_install_maybe_enable_pretty_permalinks();
|
wp_install_maybe_enable_pretty_permalinks();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.4-alpha-46988';
|
$wp_version = '5.4-alpha-46989';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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