From c26805d326cd730e85630cbeaf44eb3960741c6f Mon Sep 17 00:00:00 2001 From: wpmuguru Date: Mon, 1 Feb 2010 18:01:23 +0000 Subject: [PATCH] minor fixes/improvements to populate_network(), see #11644 git-svn-id: http://svn.automattic.com/wordpress/trunk@12919 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/schema.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index b9ccbe04f0..93ff523f8f 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -657,12 +657,13 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam /* translators: Default category slug */ $cat_slug = sanitize_title( _x( 'Uncategorized', 'Default category slug' ) ); - $wpdb->insert( $wpdb->sitecategories, array( 'site_id' => $network_id, 'cat_ID' => 1, 'cat_name' => __('Uncategorized'), 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ) ) ); + $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => 1, 'cat_name' => __('Uncategorized'), 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ) ) ); /* translators: Default link category slug */ $cat_slug = sanitize_title( _x( 'Blogroll', 'Default link category slug' ) ); - $wpdb->insert( $wpdb->sitecategories, array( 'site_id' => $network_id, 'cat_ID' => 2, 'cat_name' => __('Blogroll'), 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ) ) ); + $wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => 2, 'cat_name' => __('Blogroll'), 'category_nicename' => $cat_slug, 'last_updated' => current_time( 'mysql', true ) ) ); + $wpdb->query( "INSERT INTO $wpdb->sitecategories (cat_id, cat_name, category_nicename, last_updated) SELECT term_id, `name`, slug, NOW() FROM $wpdb->terms WHERE term_id > 2" ); $site_admins = array( $site_user->user_login ); $users = get_users_of_blog(); @@ -727,9 +728,9 @@ Thanks! if ( !is_multisite() ) { $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path ) ); - + $blog_id = $wpdb->insert_id; update_usermeta( $site_user->ID, 'source_domain', $domain ); - update_usermeta( $site_user->ID, 'primary_blog', 1 ); + update_usermeta( $site_user->ID, 'primary_blog', $blog_id ); } if ( $vhost == 'yes' )