Make WordPress Core


Ignore:
Timestamp:
12/20/2010 05:25:39 PM (14 years ago)
Author:
ryan
Message:

Add 'who' arg to wp_dropdown_users() and get_users(). Add' hide_if_only_one_author' argument to get_users(). Query only authors (user level greater than 0) when who => author is passed. Query only authors for author meta box and quick edit dropdowns. Props scribu. fixes #15871

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r16992 r17088  
    758758            </div>
    759759            <br class="clear" />
    760 
    761760    <?php endif; // $bulk
    762761
     
    766765            if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
    767766                $users_opt = array(
     767                    'hide_if_only_one_author' => true,
     768                    'who' => 'authors',
    768769                    'name' => 'post_author',
    769770                    'class'=> 'authors',
     
    773774                if ( $bulk )
    774775                    $users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
    775                 $authors_dropdown  = '<label>';
    776                 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
    777                 $authors_dropdown .= wp_dropdown_users( $users_opt );
    778                 $authors_dropdown .= '</label>';
     776
     777                if ( $authors = wp_dropdown_users( $users_opt ) ) :
     778                    $authors_dropdown  = '<label>';
     779                    $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
     780                    $authors_dropdown .= $authors;
     781                    $authors_dropdown .= '</label>';
     782                endif;
    779783            endif; // authors
    780784    ?>
Note: See TracChangeset for help on using the changeset viewer.