Ticket #30064: 30064_gowp1-3.diff
File 30064_gowp1-3.diff, 1.7 KB (added by , 10 years ago) |
---|
-
wp-includes/user.php
600 600 601 601 // sorting 602 602 if ( isset( $qv['orderby'] ) ) { 603 604 /** 605 * Sanitize and clean up include parameter before checking for contents 606 * if it ends up empty after checking, we dont want to try to sort on nothing 607 */ 608 if ( 'include' == $qv['orderby'] && ! empty($qv['include'])) { 609 $include = is_string( $qv['include'] ) ? explode( ',', $qv['include'] ) : $qv['include']; 610 611 if ( is_array($include) ) { 612 // sanitize array for ID values 613 $include = array_map( 'intval', $include ); 614 // cleaning up the unwanted values: 615 // filter out all 0 values 616 $include = array_filter( $include ); 617 // remove possible duplicates 618 $include = array_unique( $include ); 619 620 // please advice: use new variable or put back 621 // should the parameters be formatted more globally? 622 $qv['include'] = $include; 623 } 624 } 625 603 626 if ( in_array( $qv['orderby'], array('nicename', 'email', 'url', 'registered') ) ) { 604 627 $orderby = 'user_' . $qv['orderby']; 605 628 } elseif ( in_array( $qv['orderby'], array('user_nicename', 'user_email', 'user_url', 'user_registered') ) ) { … … 621 644 $orderby = 'ID'; 622 645 } elseif ( 'meta_value' == $qv['orderby'] ) { 623 646 $orderby = "$wpdb->usermeta.meta_value"; 624 } else { 647 } elseif ( 'include' == $qv['orderby'] && ! empty( $qv['include'] ) ) { 648 $include = implode( ",", $qv['include'] ); 649 $orderby = "FIELD( {$wpdb->users}.ID, {$include} )"; 650 } else { 625 651 $orderby = 'user_login'; 626 652 } 627 653 }