Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/05/2013 06:11:56 PM (13 years ago)
Author:
boonebgorges
Message:

Convert total_friend_count to SIGNED before attempting to sort with it

This fixes issues in BP_User_Query where the 'popular' sort order was sorting
by friend count interpreted as a string (ie, alphabetically) instead of
numerically.

Fixes #4937

Props merty

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-classes.php

    r6934 r6996  
    235235                                $sql['select']  = "SELECT DISTINCT u.{$this->uid_name} as id FROM {$wpdb->usermeta} u";
    236236                                $sql['where'][] = $wpdb->prepare( "u.meta_key = %s", bp_get_user_meta_key( 'total_friend_count' ) );
    237                                 $sql['orderby'] = "ORDER BY u.meta_value";
     237                                $sql['orderby'] = "ORDER BY CONVERT(u.meta_value, SIGNED)";
    238238                                $sql['order']   = "DESC";
    239239
Note: See TracChangeset for help on using the changeset viewer.