Ticket #15871: levels.15871.diff
File levels.15871.diff, 7.2 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-includes/meta.php
386 386 $i = 0; 387 387 foreach ( $meta_query as $q ) { 388 388 $meta_key = isset( $q['key'] ) ? trim( $q['key'] ) : ''; 389 $meta_value = isset( $q['value'] ) ? $q['value'] : ''; 389 390 390 $meta_compare = isset( $q['compare'] ) ? strtoupper( $q['compare'] ) : '='; 391 $meta_type = isset( $q['type'] ) ? strtoupper( $q['type'] ) : 'CHAR'; 392 393 if ( ! in_array( $meta_compare, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) 391 if ( ! in_array( $meta_compare, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) { 394 392 $meta_compare = '='; 393 } 395 394 396 if ( 'NUMERIC' == $meta_type ) 395 $meta_value = isset( $q['value'] ) ? $q['value'] : ''; 396 if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) { 397 if ( ! is_array( $meta_value ) ) 398 $meta_value = preg_split( '/[,\s]+/', $meta_value ); 399 } else { 400 $meta_value = trim( $meta_value ); 401 } 402 403 $no_meta_value = ( '' === $meta_value || ( is_array( $meta_value ) && empty( $meta_value ) ) ); 404 405 $meta_type = isset( $q['type'] ) ? strtoupper( $q['type'] ) : 'CHAR'; 406 if ( 'NUMERIC' == $meta_type ) { 397 407 $meta_type = 'SIGNED'; 398 elseif ( ! in_array( $meta_type, array( 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED' ) ) )408 } elseif ( ! in_array( $meta_type, array( 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED' ) ) ) { 399 409 $meta_type = 'CHAR'; 410 } 400 411 401 if ( empty( $meta_key ) && empty( $meta_value ))412 if ( empty( $meta_key ) && $no_meta_value ) 402 413 continue; 403 414 404 415 $alias = $i ? 'mt' . $i : $meta_table; … … 412 423 if ( !empty( $meta_key ) ) 413 424 $where .= $wpdb->prepare( " AND $alias.meta_key = %s", $meta_key ); 414 425 415 if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) { 416 if ( ! is_array( $meta_value ) ) 417 $meta_value = preg_split( '/[,\s]+/', $meta_value ); 418 } else { 419 $meta_value = trim( $meta_value ); 420 } 421 422 if ( empty( $meta_value ) ) 426 if ( $no_meta_value ) 423 427 continue; 424 428 425 429 if ( 'IN' == substr( $meta_compare, -2) ) { … … 452 456 453 457 // Simple query needs to be first for orderby=meta_value to work correctly 454 458 foreach ( array( 'key', 'value', 'compare', 'type' ) as $key ) { 455 if ( !empty( $qv[ "meta_$key" ] ) )459 if ( isset( $qv[ "meta_$key" ] ) ) 456 460 $meta_query[0][ $key ] = $qv[ "meta_$key" ]; 457 461 } 458 462 -
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_non_subscribers(); 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_non_subscribers(), 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_non_subscribers() { 2176 global $wpdb, $blog_id; 2177 2178 $args = array( 2179 'fields' => array( 'ID', 'display_name' ), 2180 'orderby' => 'display_name', 2181 'order' => 'ASC' 2182 ); 2183 2184 if ( !is_multisite() ) { // super-admins don't have user_levels 2185 $args = array_merge( $args, array( 2186 'meta_key' => $wpdb->get_blog_prefix( $blog_id ) . 'user_level', 2187 'meta_value' => '0', 2188 'meta_compare' => '!=', 2189 'blog_id' => 0, // avoid additional meta query 2190 ) ); 2191 } 2192 2193 return get_users( $args ); 2194 } 2195