WordPress.org

Make WordPress Core

Changeset 15876


Ignore:
Timestamp:
10/20/2010 08:43:32 PM (10 years ago)
Author:
ryan
Message:

Add query args argument to get_users_of_blog(). Limit number of users fetched for user lists in sites table and edit blog form. see #15053

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/default-list-tables.php

    r15870 r15876  
    29592959                        <td valign="top">
    29602960                            <?php
    2961                             $blogusers = get_users_of_blog( $blog['blog_id'] );
     2961                            $blogusers = get_users_of_blog( $blog['blog_id'], array('number' => 6) );
    29622962                            if ( is_array( $blogusers ) ) {
    29632963                                $blogusers_warning = '';
  • trunk/wp-admin/network/sites.php

    r15759 r15876  
    258258
    259259                // Site users
    260                 $blogusers = get_users_of_blog( $id );
    261 
     260                $blogusers = get_users_of_blog( $id, array('number' => 20) );
    262261                if ( is_array( $blogusers ) ) {
    263262                    echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __( 'Site Users' ) . '</span></h3><div class="inside">';
    264263                    echo '<table class="form-table">';
    265264                    echo "<tr><th>" . __( 'User' ) . "</th><th>" . __( 'Role' ) . "</th><th>" . __( 'Password' ) . "</th><th>" . __( 'Remove' ) . "</th></tr>";
     265                    $user_count = 0;
    266266                    foreach ( $blogusers as $user_id => $user_object ) {
     267                        $user_count++;
    267268                        $existing_role = reset( $user_object->roles );
    268269
     
    291292                    echo "</table>";
    292293                    echo '<p class="submit" style="text-align:center;"><input type="submit" name="Submit" value="' . esc_attr__( 'Update Options' ) . '" /></p>';
     294                    if ( 20 == $user_count )
     295                        echo '<p>' . sprintf( __('First 20 users shown. <a href="%s">Manage all users</a>.'), get_admin_url($id, 'users.php') ) . '</p>';
    293296                    echo "</div></div>";
    294297                }
  • trunk/wp-includes/user.php

    r15873 r15876  
    564564 *
    565565 * @param int $id Blog ID.
     566 * @param array $args Optional query arguments passed to get_users()
    566567 * @return array List of users that are part of that Blog ID
    567568 */
    568 function get_users_of_blog( $id = '' ) {
     569function get_users_of_blog( $id = '', $args = array() ) {
    569570    global $blog_id;
    570571
     
    572573        $id = (int) $blog_id;
    573574
    574     return get_users( array( 'blog_id' => $id ) );
     575    $args['blog_id'] = $id;
     576    return get_users( $args );
    575577}
    576578
Note: See TracChangeset for help on using the changeset viewer.