Make WordPress Core


Ignore:
Timestamp:
08/26/2013 06:56:32 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Avoid a PHP notice in wpmu_create_blog() if $meta is not passed. props duck_, jeremyfelt, SergeyBiryukov. fixes #20793.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r25113 r25127  
    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 ) {
     940    $defaults = array( 'public' => 0 );
     941    $meta = wp_parse_args( $meta, $defaults );
     942
    940943    $domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
    941944
     
    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
     
    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 ) )
Note: See TracChangeset for help on using the changeset viewer.