Ticket #22212: user.php.patch
File user.php.patch, 1.6 KB (added by , 12 years ago) |
---|
-
wp-includes/user.php
360 360 if ( !empty( $query ) ) { 361 361 $this->query_vars = wp_parse_args( $query, array( 362 362 'blog_id' => $GLOBALS['blog_id'], 363 'role' => '',363 'role' => array(), 364 364 'meta_key' => '', 365 365 'meta_value' => '', 366 366 'meta_compare' => '', … … 492 492 $qv['blog_id'] = $blog_id = 0; // Prevent extra meta query 493 493 } 494 494 495 $role = trim( $qv['role'] ); 495 $roles = $qv['role']; 496 if( is_string( $roles ) ) { 497 $roles = array( $roles ); 498 } 496 499 497 if ( $blog_id && ( $role || is_multisite() ) ) { 498 $cap_meta_query = array(); 499 $cap_meta_query['key'] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities'; 500 if ( $blog_id && ( !empty( $roles ) || is_multisite() ) ) { 501 if( !empty( $roles ) ) { 502 // Set relation 503 $qv['meta_query']['relation'] = 'OR'; 500 504 501 if ( $role ) { 502 $cap_meta_query['value'] = '"' . $role . '"'; 503 $cap_meta_query['compare'] = 'like'; 505 foreach( $roles as $role ) { 506 $cap_meta_query = array(); 507 $cap_meta_query['key'] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities'; 508 $cap_meta_query['value'] = '"' . trim( $role ) . '"'; 509 $cap_meta_query['compare'] = 'like'; 510 $qv['meta_query'][] = $cap_meta_query; 511 } 512 }else { 513 // Multisite 514 $cap_meta_query = array(); 515 $cap_meta_query['key'] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities'; 516 $qv['meta_query'][] = $cap_meta_query; 504 517 } 505 506 $qv['meta_query'][] = $cap_meta_query;507 518 } 508 519 509 520 $meta_query = new WP_Meta_Query();