Make WordPress Core


Ignore:
Timestamp:
07/25/2017 12:23:44 AM (8 years ago)
Author:
johnbillion
Message:

Users: Ensure that users with no role on a site are taken into consideration when listing users on Multisite.

This ensures that users who are a member of a site but have no role are correctly listed on the Users screen and can be filtered from the 'None' role filter.

Props tobi823, flixos90, scottlee

Fixes #36196

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/wpGetUsersWithNoRole.php

    r40564 r41138  
    3737    /**
    3838     * @ticket 22993
     39     * @ticket 36196
    3940     * @group multisite
    4041     * @group ms-required
     
    5758        ) );
    5859
    59         // Add users to blogs
     60        // Add editor to blog 1
    6061        add_user_to_blog( $blog_1, $editor, 'editor' );
    6162
    6263        // Test users on root site
    6364        $users = wp_get_users_with_no_role();
     65        $this->assertSame( array(
     66            "{$nobody}",
     67        ), $users );
     68
     69        // Test users counts on blog 1
     70        $users = wp_get_users_with_no_role( $blog_1 );
    6471        $this->assertSame( array(), $users );
    6572
    66         // Test users counts on blog 1
    67         switch_to_blog( $blog_1 );
    68         $users = wp_get_users_with_no_role();
    69         restore_current_blog();
     73        // Add admin to blog 1 with no role
     74        add_user_to_blog( $blog_1, $admin, '' );
    7075
    71         // Test users on root site
    72         $this->assertSame( array(), $users );
    73 
     76        // Re-test users counts on blog 1
     77        $users = wp_get_users_with_no_role( $blog_1 );
     78        $this->assertSame( array(
     79            "{$admin}",
     80        ), $users );
    7481    }
    7582
Note: See TracChangeset for help on using the changeset viewer.