WordPress.org

Plugin Directory

Changeset 111008


Ignore:
Timestamp:
04/16/09 12:02:52 (6 years ago)
Author:
bforchhammer
Message:

Fixed numeric sorting issues (user_id and post count)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • author-avatars/trunk/lib/UserList.class.php

    r103494 r111008  
    338338     */ 
    339339    function _users_cmp_id($a, $b) { 
    340         return strcmp($a->user_id, $b->user_id); 
     340        if ($a->user_id == $b->user_id) return 0; 
     341        return ($a->user_id < $b->user_id) ? -1 : 1; 
    341342    } 
    342343 
     
    374375     */ 
    375376    function _user_cmp_postcount($a, $b) { 
    376         return strcmp($this->get_user_postcount($b->user_id), $this->get_user_postcount($a->user_id)); 
     377        $ac = $this->get_user_postcount($a->user_id); 
     378        $bc = $this->get_user_postcount($b->user_id); 
     379         
     380        if ($ac == $bc) return 0; 
     381        return ($ac > $bc) ? -1 : 1; 
    377382    } 
    378383     
Note: See TracChangeset for help on using the changeset viewer.