Ticket #22212: 22212.3.diff
File 22212.3.diff, 1.8 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class-wp-user-query.php
304 304 foreach ( $roles as $role ) { 305 305 $roles_clauses[] = array( 306 306 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 307 'value' => $role,307 'value' => '"' . $role . '"', 308 308 'compare' => 'LIKE', 309 309 ); 310 310 } … … 317 317 foreach ( $role__in as $role ) { 318 318 $role__in_clauses[] = array( 319 319 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 320 'value' => $role,320 'value' => '"' . $role . '"', 321 321 'compare' => 'LIKE', 322 322 ); 323 323 } … … 330 330 foreach ( $role__not_in as $role ) { 331 331 $role__not_in_clauses[] = array( 332 332 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', 333 'value' => $role,333 'value' => '"' . $role . '"', 334 334 'compare' => 'NOT LIKE', 335 335 ); 336 336 } -
tests/phpunit/tests/user/query.php
958 958 /** 959 959 * @ticket 22212 960 960 */ 961 public function test_get_single_role_by_string_which_is_similar() { 962 $this->factory->user->create_many( 2, array( 963 'role' => 'editor', 964 ) ); 965 966 $this->factory->user->create( array( 967 'role' => 'another-editor', 968 ) ); 969 970 $users = get_users( array( 971 'role' => 'editor', 972 ) ); 973 974 $this->assertEquals( 2, count( $users ) ); 975 } 976 977 978 /** 979 * @ticket 22212 980 */ 961 981 public function test_get_single_role_by_array() { 962 982 $this->factory->user->create_many( 2, array( 963 983 'role' => 'subscriber',