@@ -936,7 +936,10 @@ function wpmu_create_user( $user_name, $password, $email ) {
936936 * @param int $site_id Optional. Only relevant on multi-network installs.
937937 * @return mixed Returns WP_Error object on failure, int $blog_id on success
938938 */
939- function wpmu_create_blog ($ domain , $ path , $ title , $ user_id , $ meta = '' , $ site_id = 1 ) {
939+ function wpmu_create_blog ( $ domain , $ path , $ title , $ user_id , $ meta = '' , $ site_id = 1 ) {
940+ $ defaults = array ( 'public ' => 0 );
941+ $ meta = wp_parse_args ( $ meta , $ defaults );
942+
940943 $ domain = preg_replace ( '/\s+/ ' , '' , sanitize_user ( $ domain , true ) );
941944
942945 if ( is_subdomain_install () )
@@ -964,15 +967,15 @@ function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id
964967
965968 add_user_to_blog ($ blog_id , $ user_id , 'administrator ' );
966969
967- if ( is_array ( $ meta) ) foreach ( $ meta as $ key => $ value ) {
968- if ( $ key == 'public ' || $ key == 'archived ' || $ key == 'mature ' || $ key == 'spam ' || $ key == 'deleted ' || $ key == 'lang_id ' )
970+ foreach ( $ meta as $ key => $ value ) {
971+ if ( in_array ( $ key, array ( 'public ' , 'archived ' , 'mature ' , 'spam ' , 'deleted ' , 'lang_id ' ) ) )
969972 update_blog_status ( $ blog_id , $ key , $ value );
970973 else
971974 update_option ( $ key , $ value );
972975 }
973976
974977 add_option ( 'WPLANG ' , get_site_option ( 'WPLANG ' ) );
975- update_option ( 'blog_public ' , (int )$ meta ['public ' ] );
978+ update_option ( 'blog_public ' , (int ) $ meta ['public ' ] );
976979
977980 if ( ! is_super_admin ( $ user_id ) && ! get_user_meta ( $ user_id , 'primary_blog ' , true ) )
978981 update_user_meta ( $ user_id , 'primary_blog ' , $ blog_id );
0 commit comments