Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-6799

Memberlist sorting for last activity done on wrong array

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 3.0.1
    • 3.0.0
    • None
    • PHP Environment:
      Database:

      memberlist.php includes a function to update the sorting of the last activity. But while the sorting works quite fine, it is done on the wrong array:

               // If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date... 
               if ($sort_key == 'l') 
               { 
                  $lesser_than = ($sort_dir == 'a') ? -1 : 1; 
                  uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));")); 
               }

      Since the sequence of the entries is determined by $user_list instead of $id_cache, sorting is done without effect to the search results.

      To fix, line 1373 should be changed:

      				uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));"));

      to

      				usort($user_list, create_function('$first, $second', "global \$id_cache; return (\$id_cache[\$first]['last_visit'] == \$id_cache[\$second]['last_visit']) ? 0 : ((\$id_cache[\$first]['last_visit'] < \$id_cache[\$second]['last_visit']) ? $lesser_than : ($lesser_than * -1));"));

      Pleas keep in mind, that this sorting will only affect the current page since the page filter is applied at an earlier time.

            Acyd Burn Meik Sievertsen [X] (Inactive)
            PhilippK PhilippK [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: