Changeset 1293


Ignore:
Timestamp:
03/10/10 15:06:06 (3 years ago)
Author:
nick_ramsay
Message:

[Branch 1.2] Posts ranked by vote (e.g. Upcoming and All-Time) are now ranked first by vote, second by date so newer posts are listed above other posts with the same number of votes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/content/plugins/sb_base/libs/SbBaseFunctions.php

    r1217 r1293  
    129129            $end = date('YmdHis', strtotime($upcoming_duration)); // should be negative 
    130130            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    131             $h->vars['orderby'] = "post_votes_up DESC"; 
     131            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    132132        }  
    133133        elseif ($type == 'top-24-hours') 
     
    138138            $end = date('YmdHis', strtotime("-1 day")); 
    139139            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    140             $h->vars['orderby'] = "post_votes_up DESC"; 
     140            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    141141        }  
    142142        elseif ($type == 'top-48-hours')  
     
    147147            $end = date('YmdHis', strtotime("-2 days")); 
    148148            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    149             $h->vars['orderby'] = "post_votes_up DESC"; 
     149            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    150150        }  
    151151        elseif ($type == 'top-7-days') 
     
    156156            $end = date('YmdHis', strtotime("-7 days")); 
    157157            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    158             $h->vars['orderby'] = "post_votes_up DESC"; 
     158            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    159159        }  
    160160        elseif ($type == 'top-30-days') 
     
    165165            $end = date('YmdHis', strtotime("-30 days")); 
    166166            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    167             $h->vars['orderby'] = "post_votes_up DESC"; 
     167            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    168168        }  
    169169        elseif ($type == 'top-365-days') 
     
    174174            $end = date('YmdHis', strtotime("-365 days")); 
    175175            $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start);  
    176             $h->vars['orderby'] = "post_votes_up DESC"; 
     176            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    177177        }  
    178178        elseif ($type == 'top-all-time') 
     
    180180            // Filters page to "top" stories in order of votes 
    181181            $h->vars['filter']['post_status = %s'] = 'top';  
    182             $h->vars['orderby'] = "post_votes_up DESC"; 
     182            $h->vars['orderby'] = "post_votes_up DESC, post_date DESC"; 
    183183        }  
    184184        elseif ($type == 'top') 
Note: See TracChangeset for help on using the changeset viewer.