Accommodate multi-blog setups that share user tables by checking to see if the admin user already exists during install.
git-svn-id: http://svn.automattic.com/wordpress/trunk@3692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9ffdbe2230
commit
6a1fbbfdd9
|
@ -27,9 +27,16 @@ function wp_install($blog_title, $user_name, $user_email, $public, $meta='') {
|
||||||
if ( ! $public )
|
if ( ! $public )
|
||||||
update_option('default_pingback_flag', 0);
|
update_option('default_pingback_flag', 0);
|
||||||
|
|
||||||
// Create default user.
|
// Create default user. If the user already exists, the user tables are
|
||||||
$random_password = substr(md5(uniqid(microtime())), 0, 6);
|
// being shared among blogs. Just set the role in that case.
|
||||||
$user_id = wp_create_user($user_name, $random_password, $user_email);
|
$user_id = username_exists($user_name);
|
||||||
|
if ( !$user_id ) {
|
||||||
|
$random_password = substr(md5(uniqid(microtime())), 0, 6);
|
||||||
|
$user_id = wp_create_user($user_name, $random_password, $user_email);
|
||||||
|
} else {
|
||||||
|
$random_password = __('User already exists. Password inherited.');
|
||||||
|
}
|
||||||
|
|
||||||
$user = new WP_User($user_id);
|
$user = new WP_User($user_id);
|
||||||
$user->set_role('administrator');
|
$user->set_role('administrator');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue