Make WordPress Core

Ticket #20793: 20793.4.diff

File 20793.4.diff, 1.6 KB (added by SergeyBiryukov, 13 years ago)
  • src/wp-includes/ms-functions.php

     
    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) {
     939function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = '', $site_id = 1 ) {
    940940        $domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
    941941
    942942        if ( is_subdomain_install() )
     
    964964
    965965        add_user_to_blog($blog_id, $user_id, 'administrator');
    966966
    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' )
     967        foreach ( (array) $meta as $key => $value ) {
     968                if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
    969969                        update_blog_status( $blog_id, $key, $value );
    970970                else
    971971                        update_option( $key, $value );
     
    972972        }
    973973
    974974        add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
    975         update_option( 'blog_public', (int)$meta['public'] );
    976975
     976        if ( ! $meta )
     977                $meta = array( 'public' => 0 );
     978
     979        update_option( 'blog_public', (int) $meta['public'] );
     980
    977981        if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
    978982                update_user_meta( $user_id, 'primary_blog', $blog_id );
    979983