Avoid a PHP notice in wpmu_create_blog() if $meta is not passed. props duck_, jeremyfelt, SergeyBiryukov. fixes #20793.
git-svn-id: https://develop.svn.wordpress.org/trunk@25127 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7bc3ebf033
commit
35e43e187d
|
@ -937,6 +937,9 @@ function wpmu_create_user( $user_name, $password, $email ) {
|
|||
* @return mixed Returns WP_Error object on failure, int $blog_id on success
|
||||
*/
|
||||
function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = '', $site_id = 1 ) {
|
||||
$defaults = array( 'public' => 0 );
|
||||
$meta = wp_parse_args( $meta, $defaults );
|
||||
|
||||
$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
|
||||
|
||||
if ( is_subdomain_install() )
|
||||
|
@ -964,8 +967,8 @@ function wpmu_create_blog($domain, $path, $title, $user_id, $meta = '', $site_id
|
|||
|
||||
add_user_to_blog($blog_id, $user_id, 'administrator');
|
||||
|
||||
if ( is_array($meta) ) foreach ($meta as $key => $value) {
|
||||
if ( $key == 'public' || $key == 'archived' || $key == 'mature' || $key == 'spam' || $key == 'deleted' || $key == 'lang_id' )
|
||||
foreach ( $meta as $key => $value ) {
|
||||
if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
|
||||
update_blog_status( $blog_id, $key, $value );
|
||||
else
|
||||
update_option( $key, $value );
|
||||
|
|
Loading…
Reference in New Issue