#17179 closed enhancement (duplicate)
Sort user by metadata value
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.1 |
Component: | Users | Keywords: | has-patch |
Focuses: | Cc: |
Description
It would be nice to sort users by metadata value, the way it works for posts. For instance:
$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:
} 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";
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Actual patch