Allow actual DB fields in WP_User_Query orderby. props duck, see #15816.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-12-15 16:51:38 +00:00
parent 27042c1f16
commit 899f0e115d
2 changed files with 3 additions and 1 deletions

View File

@ -352,7 +352,7 @@ function update_meta_cache($meta_type, $object_ids) {
return $cache;
}
/*
/**
* Given a meta query, generates SQL clauses to be appended to a main query
*
* @since 3.1.0

View File

@ -412,6 +412,8 @@ class WP_User_Query {
// sorting
if ( in_array( $qv['orderby'], array('email', 'url', 'registered') ) ) {
$orderby = 'user_' . $qv['orderby'];
} elseif ( in_array( $qv['orderby'], array('user_email', 'user_url', 'user_registered') ) ) {
$orderby = $qv['orderby'];
} elseif ( 'name' == $qv['orderby'] || 'display_name' == $qv['orderby'] ) {
$orderby = 'display_name';
} elseif ( 'post_count' == $qv['orderby'] ) {