WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/07/2010 07:34:18 PM (11 years ago)
Author:
ryan
Message:

First pass of user admin. Network admin and screen cleanups. see #14696

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network/edit.php

    r15669 r15746  
    5353                        $user_list = '';
    5454                        foreach ( $blog_users as $user ) {
    55                             if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
    56                                 $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
     55                            if ( $user->user_id != $val && !in_array( $user->id, $allusers ) )
     56                                $user_list .= "<option value='{$user->id}'>{$user->user_login}</option>";
    5757                        }
    5858                        if ( '' == $user_list )
     
    138138            update_site_option( 'banned_email_domains', '' );
    139139        }
    140         update_site_option( 'default_user_role', $_POST['default_user_role'] );
    141         if ( trim( $_POST['dashboard_blog_orig'] ) == '' )
    142             $_POST['dashboard_blog_orig'] = $current_site->blog_id;
    143         if ( trim( $_POST['dashboard_blog'] ) == '' ) {
    144             $_POST['dashboard_blog'] = $current_site->blog_id;
    145             $dashboard_blog_id = $current_site->blog_id;
    146         } elseif ( ! preg_match( '/(--|\.)/', $_POST['dashboard_blog'] ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $_POST['dashboard_blog'] ) ) {
    147             $dashboard_blog = $_POST['dashboard_blog'];
    148             $blog_details = get_blog_details( $dashboard_blog );
    149             if ( false === $blog_details ) {
    150                 if ( is_numeric( $dashboard_blog ) )
    151                     wp_die( __( 'A dashboard site referenced by ID must already exist' ) );
    152                 if ( is_subdomain_install() ) {
    153                     $domain = $dashboard_blog . '.' . $current_site->domain;
    154                     $path = $current_site->path;
    155                 } else {
    156                     $domain = $current_site->domain;
    157                     $path = trailingslashit( $current_site->path . $dashboard_blog );
    158                 }
    159                 $wpdb->hide_errors();
    160                 $dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( 'public' => 0 ), $current_site->id );
    161                 $wpdb->show_errors();
    162             } else {
    163                 $dashboard_blog_id = $blog_details->blog_id;
    164             }
    165         }
    166         if ( is_wp_error( $dashboard_blog_id ) )
    167             wp_die( __( 'Problem creating dashboard site: ' ) . $dashboard_blog_id->get_error_message() );
    168         if ( $_POST['dashboard_blog_orig'] != $_POST['dashboard_blog'] ) {
    169             $users = get_users_of_blog( get_site_option( 'dashboard_blog' ) );
    170             $move_users = array();
    171             foreach ( (array)$users as $user ) {
    172                 $user_meta_value = unserialize( $user->meta_value );
    173                 if ( is_array( $user_meta_value ) && array_pop( $var_by_ref = array_keys( $user_meta_value ) ) == 'subscriber' )
    174                     $move_users[] = $user->user_id;
    175             }
    176             if ( false == empty( $move_users ) ) {
    177                 foreach ( (array)$move_users as $user_id ) {
    178                     remove_user_from_blog($user_id, get_site_option( 'dashboard_blog' ) );
    179                     add_user_to_blog( $dashboard_blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    180                     update_user_meta( $user_id, 'primary_blog', $dashboard_blog_id );
    181                 }
    182             }
    183         }
    184         update_site_option( 'dashboard_blog', $dashboard_blog_id );
    185 
    186         $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed', 'global_terms_enabled' );
     140
     141        $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled' );
    187142        $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );
    188143        foreach ( $checked_options as $option_name => $option_unchecked_value ) {
     
    256211        $wpdb->show_errors();
    257212        if ( !is_wp_error( $id ) ) {
    258             $dashboard_blog = get_dashboard_blog();
    259             if ( !is_super_admin( $user_id ) && get_user_option( 'primary_blog', $user_id ) == $dashboard_blog->blog_id )
     213            if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) )
    260214                update_user_option( $user_id, 'primary_blog', $id, true );
    261215            $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) );
     
    688642            wp_new_user_notification( $user_id, $password );
    689643
    690         if ( get_site_option( 'dashboard_blog' ) == false )
    691             add_user_to_blog( $current_site->blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    692         else
    693             add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    694 
    695644        wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) );
    696645        exit();
Note: See TracChangeset for help on using the changeset viewer.