WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-admin/ms-edit.php

    r15244 r15470  
    105105            foreach ( (array)$users as $user ) {
    106106                $user_meta_value = unserialize( $user->meta_value );
    107                 if ( is_array( $user_meta_value ) && array_pop( array_keys( $user_meta_value ) ) == 'subscriber' )
     107                if ( is_array( $user_meta_value ) && array_pop( $var_by_ref = array_keys( $user_meta_value ) ) == 'subscriber' )
    108108                    $move_users[] = $user->user_id;
    109109            }
     
    119119
    120120        $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' );
    121         $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1 );
     121        $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );
    122122        foreach ( $checked_options as $option_name => $option_unchecked_value ) {
    123123            if ( ! isset( $_POST[$option_name] ) )
     
    227227            $c = 1;
    228228            $count = count( $_POST['option'] );
     229            $skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form.
    229230            foreach ( (array) $_POST['option'] as $key => $val ) {
    230                 if ( $key === 0 || is_array( $val ) )
     231                if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) )
    231232                    continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
    232233                if ( $c == $count )
     
    265266            foreach ( (array) $newroles as $userid => $role ) {
    266267                $user = new WP_User( $userid );
    267                 if ( ! $user )
     268                if ( empty( $user->ID ) )
    268269                    continue;
    269270                $user->for_blog( $id );
     
    287288                $_POST['role'] = $newroles[ $userid ];
    288289                if ( $pass != '' ) {
    289                     $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
     290                    $cap = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'", $userid ) );
    290291                    $userdata = get_userdata($userid);
    291292                    $_POST['pass1'] = $_POST['pass2'] = $pass;
     
    294295                    edit_user( $userid );
    295296                    if ( $cap == null )
    296                         $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id = '{$userid}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" );
     297                        $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'", $userid ) );
    297298                }
    298299            }
Note: See TracChangeset for help on using the changeset viewer.