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. git-svn-id: https://develop.svn.wordpress.org/trunk@46989 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
38cfdae6e9
commit
d592888f36
@ -82,16 +82,20 @@ if ( ! function_exists( 'wp_install' ) ) :
|
||||
$user_id = username_exists( $user_name );
|
||||
$user_password = trim( $user_password );
|
||||
$email_password = false;
|
||||
$user_created = false;
|
||||
|
||||
if ( ! $user_id && empty( $user_password ) ) {
|
||||
$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.' );
|
||||
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
||||
update_user_option( $user_id, 'default_password_nag', true, true );
|
||||
$email_password = true;
|
||||
$user_created = true;
|
||||
} elseif ( ! $user_id ) {
|
||||
// Password has been provided
|
||||
$message = '<em>' . __( 'Your chosen password.' ) . '</em>';
|
||||
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
||||
// Password has been provided.
|
||||
$message = '<em>' . __( 'Your chosen password.' ) . '</em>';
|
||||
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
||||
$user_created = true;
|
||||
} else {
|
||||
$message = __( 'User already exists. Password inherited.' );
|
||||
}
|
||||
@ -99,6 +103,11 @@ if ( ! function_exists( 'wp_install' ) ) :
|
||||
$user = new WP_User( $user_id );
|
||||
$user->set_role( 'administrator' );
|
||||
|
||||
if ( $user_created ) {
|
||||
$user->user_url = $guessurl;
|
||||
wp_update_user( $user );
|
||||
}
|
||||
|
||||
wp_install_defaults( $user_id );
|
||||
|
||||
wp_install_maybe_enable_pretty_permalinks();
|
||||
|
Loading…
Reference in New Issue
Block a user