Ticket #38234: 38234.2.patch
| File 38234.2.patch, 1.5 KB (added by , 10 years ago) |
|---|
-
src/wp-includes/user.php
2440 2440 } 2441 2441 2442 2442 $prefix = $wpdb->get_blog_prefix(); 2443 $regex = implode( '|', wp_roles()->get_names() );2443 $regex = implode( '|', array_keys( wp_roles()->get_names() ) ); 2444 2444 $regex = preg_replace( '/[^a-zA-Z_\|-]/', '', $regex ); 2445 2445 $users = $wpdb->get_col( $wpdb->prepare( " 2446 2446 SELECT user_id -
tests/phpunit/tests/user/wpGetUsersWithNoRole.php
6 6 class Tests_User_GetUsersWithNoRole extends WP_UnitTestCase { 7 7 8 8 /** 9 * Role comparison must be done on role name, not role display name. 10 * 11 * @ticket 38234 12 */ 13 public function test_get_users_with_no_role_matches_on_role_name() { 14 // Create a role with a display name which would not match the role name 15 // in a case-insentive SQL query. 16 global $wp_roles; 17 $wp_roles->add_role( 'somerole', 'Some role display name' ); 18 19 $someuser = self::factory()->user->create( array( 20 'role' => 'somerole', 21 ) ); 22 23 $users = wp_get_users_with_no_role(); 24 25 $this->assertEquals( array(), $users ); 26 } 27 28 /** 9 29 * @ticket 22993 10 30 */ 11 31 public function test_get_users_with_no_role_is_accurate() {