[wp-trac] [WordPress Trac] #17179: Sort user by metadata value
WordPress Trac
wp-trac at lists.automattic.com
Tue Apr 19 16:11:57 UTC 2011
#17179: Sort user by metadata value
-------------------------+-----------------------------
Reporter: ziofix | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 3.1
Severity: minor | Keywords: has-patch
-------------------------+-----------------------------
It would be nice to sort users by metadata value, the way it works for
posts. For instance:
{{{
#!php
$users = get_users(array(
'orderby' => 'meta_value_num',
'order' => 'DESC',
'meta_key' => 'score',
));
}}}
Therefore it needs to add the lines below at line 436 of file wp-
includes/user.php:
{{{
#!php
} elseif( (!empty($qv['meta_key'])) && ( 'meta_value' == $qv['orderby']) )
{
$orderby = "$wpdb->usermeta.meta_value";
} elseif( (!empty($qv['meta_key'])) && ( 'meta_value_num' ==
$qv['orderby']) ) {
$orderby = "$wpdb->usermeta.meta_value+0";
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17179>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list