Sorting

Anna

Member
This may or may not turn into a plugin-request eventually. But right now I would love just some info!
What is needed to make/change to change the way the mrmbersites are sorted? How hard is it? Gor example, by alphabeticsl order, join date, last publushed bloggpost or change (based on rss-feed) etc...!
 
Fairly easy I would think, just need to alter the ORDER BY part of sources/rankings.php

PHP:
    // Get the ranking method, default to pageviews
    $ranking_method = isset($FORM['method']) ? $FORM['method'] : $CONF['ranking_method'];
    if (($ranking_method != 'pv') && ($ranking_method != 'in') && ($ranking_method != 'out')) {
      $ranking_method = 'pv';
    }

    // Make ORDER BY clause
    $order_by = $this->rank_by($ranking_method)." DESC, unq_{$ranking_method}_overall DESC";
 
just remove the options from wrapper for rank by in an out, no need to further modify this query to do that.
 
Yes so much I understood (and have done in the past) - but what is the "code" for sorting alphabeticly?
 
Code:
$order_by = $this->rank_by($ranking_method)." DESC, unq_{$ranking_method}_overall DESC";
this ranks by your ranking method highest first, if a tie, then use overall value of ranking method

you could do for example
Code:
$order_by = $this->rank_by($ranking_method)." DESC, title ASC";
Out of the head and not tested. if tie order by title

Code:
$order_by = "title ASC";
Out of the head and not tested. simply by title only

A simple plugin hook after the orginal code to overwrite the complete line and it could be made into a plugin i guess
 
Back
Top