Changeset 17088
- Timestamp:
- 12/20/2010 05:25:39 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-posts-list-table.php
r16992 r17088 758 758 </div> 759 759 <br class="clear" /> 760 761 760 <?php endif; // $bulk 762 761 … … 766 765 if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) : 767 766 $users_opt = array( 767 'hide_if_only_one_author' => true, 768 'who' => 'authors', 768 769 'name' => 'post_author', 769 770 'class'=> 'authors', … … 773 774 if ( $bulk ) 774 775 $users_opt['show_option_none'] = __( '— No Change —' ); 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; 779 783 endif; // authors 780 784 ?> -
trunk/wp-admin/includes/meta-boxes.php
r17062 r17088 531 531 function post_author_meta_box($post) { 532 532 global $user_ID; 533 534 533 ?> 535 534 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label> 536 535 <?php 537 536 wp_dropdown_users( array( 537 'who' => 'authors', 538 538 'name' => 'post_author_override', 539 539 'selected' => empty($post->ID) ? $user_ID : $post->post_author -
trunk/wp-includes/meta.php
r17009 r17088 434 434 $meta_compare_string = '%s'; 435 435 } 436 437 // @todo Temporary hack to support empty values. Do not use outside of core. 438 if ( '_wp_zero_value' == $meta_value ) 439 $meta_value = 0; 440 436 441 $where .= $wpdb->prepare( " AND CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string}", $meta_value ); 437 442 } -
trunk/wp-includes/user.php
r17084 r17088 482 482 } 483 483 484 $blog_id = absint( $qv['blog_id'] ); 485 486 if ( 'authors' == $qv['who'] && $blog_id ) { 487 $qv['meta_key'] = $wpdb->get_blog_prefix( $blog_id ) . 'user_level'; 488 $qv['meta_value'] = '_wp_zero_value'; // Hack to pass '0' 489 $qv['meta_compare'] = '!='; 490 $qv['blog_id'] = $blog_id = 0; // Prevent extra meta query 491 } 492 484 493 _parse_meta_query( $qv ); 485 494 486 495 $role = trim( $qv['role'] ); 487 $blog_id = absint( $qv['blog_id'] );488 496 489 497 if ( $blog_id && ( $role || is_multisite() ) ) { … … 930 938 * <li>show_option_all - Text to show all and whether HTML option exists.</li> 931 939 * <li>show_option_none - Text for show none and whether HTML option exists.</li> 940 * <li>hide_if_only_one_author - Don't create the dropdown if there is only one user.</li> 932 941 * <li>orderby - SQL order by clause for what order the users appear. Default is 'display_name'.</li> 933 942 * <li>order - Default is 'ASC'. Can also be 'DESC'.</li> … … 942 951 * <li>class - Class attribute of select element.</li> 943 952 * <li>blog_id - ID of blog (Multisite only). Defaults to ID of current blog.</li> 953 * <li>who - Which users to query. Currently only 'authors' is supported. Default is all users.</li> 944 954 * </ol> 945 955 * … … 951 961 */ 952 962 function wp_dropdown_users( $args = '' ) { 953 global $wpdb;954 963 $defaults = array( 955 'show_option_all' => '', 'show_option_none' => '', 964 'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '', 956 965 'orderby' => 'display_name', 'order' => 'ASC', 957 966 'include' => '', 'exclude' => '', 'multi' => 0, 958 967 'show' => 'display_name', 'echo' => 1, 959 'selected' => 0, 'name' => 'user', 'class' => '', ' blog_id' => $GLOBALS['blog_id'],960 ' id' => '',968 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', 969 'blog_id' => $GLOBALS['blog_id'], 'who' => '' 961 970 ); 962 971 … … 966 975 extract( $r, EXTR_SKIP ); 967 976 968 $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order' ) );977 $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) ); 969 978 $query_args['fields'] = array( 'ID', $show ); 970 971 979 $users = get_users( $query_args ); 972 980 973 981 $output = ''; 974 if ( !empty($users) ) {982 if ( !empty($users) && ( empty($hide_if_only_one_author) || count($users) > 1 ) ) { 975 983 $name = esc_attr( $name ); 976 984 if ( $multi && ! $id )
Note: See TracChangeset
for help on using the changeset viewer.