Ticket #15871: levels.15871.2.diff
File levels.15871.2.diff, 4.6 KB (added by , 14 years ago) |
---|
-
wp-includes/user.php
961 961 * <li>id - Default is the value of the 'name' parameter. ID attribute of select element.</li> 962 962 * <li>class - Class attribute of select element.</li> 963 963 * <li>blog_id - ID of blog (Multisite only). Defaults to ID of current blog.</li> 964 * <li>users - Raw array of users.</li> 964 965 * </ol> 965 966 * 966 967 * @since 2.3.0 … … 970 971 * @return string|null Null on display. String of HTML content on retrieve. 971 972 */ 972 973 function wp_dropdown_users( $args = '' ) { 973 global $wpdb;974 974 $defaults = array( 975 975 'show_option_all' => '', 'show_option_none' => '', 976 976 'orderby' => 'display_name', 'order' => 'ASC', 977 977 'include' => '', 'exclude' => '', 'multi' => 0, 978 978 'show' => 'display_name', 'echo' => 1, 979 'selected' => 0, 'name' => 'user', 'class' => '', ' blog_id' => $GLOBALS['blog_id'],980 ' id' => '',979 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', 980 'blog_id' => $GLOBALS['blog_id'], 'users' => null 981 981 ); 982 982 983 983 $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; … … 985 985 $r = wp_parse_args( $args, $defaults ); 986 986 extract( $r, EXTR_SKIP ); 987 987 988 $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order' ) ); 989 $query_args['fields'] = array( 'ID', $show ); 988 if ( is_null( $users ) ) { 989 $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order' ) ); 990 $query_args['fields'] = array( 'ID', $show ); 991 $users = get_users( $query_args ); 992 } 990 993 991 $users = get_users( $query_args );992 993 994 $output = ''; 994 995 if ( !empty($users) ) { 995 996 $name = esc_attr( $name ); -
wp-admin/includes/class-wp-posts-list-table.php
757 757 <?php touch_time( 1, 1, 4, 1 ); ?> 758 758 </div> 759 759 <br class="clear" /> 760 761 760 <?php endif; // $bulk 762 761 763 762 if ( post_type_supports( $screen->post_type, 'author' ) ) : 764 763 $authors_dropdown = ''; 765 764 766 765 if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) : 767 $users_opt = array( 768 'name' => 'post_author', 769 'class'=> 'authors', 770 'multi' => 1, 771 'echo' => 0 772 ); 773 if ( $bulk ) 774 $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>'; 766 $users = _get_potential_authors(); 767 768 if ( count( $users ) > 1 ) : 769 $users_opt = array( 770 'users' => $users, 771 'name' => 'post_author', 772 'class'=> 'authors', 773 'multi' => 1, 774 'echo' => 0 775 ); 776 if ( $bulk ) 777 $users_opt['show_option_none'] = __( '— No Change —' ); 778 $authors_dropdown = '<label>'; 779 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>'; 780 $authors_dropdown .= wp_dropdown_users( $users_opt ); 781 $authors_dropdown .= '</label>'; 782 endif; 779 783 endif; // authors 780 784 ?> 781 785 -
wp-admin/includes/meta-boxes.php
530 530 */ 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 'users' => _get_potential_authors(), 538 538 'name' => 'post_author_override', 539 539 'selected' => empty($post->ID) ? $user_ID : $post->post_author 540 540 ) ); -
wp-admin/includes/template.php
2171 2171 return $button; 2172 2172 } 2173 2173 2174 // Get list of users for the author metabox and quick edit dropdowns 2175 function _get_potential_authors() { 2176 global $wpdb, $blog_id; 2177 2178 return $wpdb->get_results(" 2179 SELECT ID, display_name FROM $wpdb->users 2180 INNER JOIN $wpdb->usermeta ON ($wpdb->users.ID = $wpdb->usermeta.user_id) 2181 WHERE $wpdb->usermeta.meta_key = '" . $wpdb->get_blog_prefix( $blog_id ) . "user_level' 2182 AND $wpdb->usermeta.meta_value != '0' 2183 ORDER BY display_name ASC 2184 "); 2185 } 2186