Top Rated reorginazation hack Top Rated reorginazation hack
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Top Rated reorginazation hack

Started by Hot Rides, August 02, 2008, 03:55:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hot Rides

I was unhappy with the way coppermine ordered the top rated, as I had many pictures with the same number of votes and the same rating but a picture with only 2 views was listed higher than a picture with 24 views simply because of its filename.

So i simply added in the value for views before filename and you get the perfect affect.

the hack

in functions.inc.php

find
             
//if($select_columns != '*') $select_columns .= ', pic_rating, votes, aid, owner_id, owner_name';
                $select_columns = '*'; //allows building any data into any thumbnail caption

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND votes >= '{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET ORDER BY pic_rating DESC, votes DESC, pid DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);


and change to
              //if($select_columns != '*') $select_columns .= ', pic_rating, votes, aid, owner_id, owner_name, hits';
                $select_columns = '*'; //allows building any data into any thumbnail caption

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND votes >= '{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET ORDER BY pic_rating DESC, votes DESC, hits DESC, pid DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);


notice the addition of the 'hits' value, thats all
I really think coppermine should arrange this way by default

Hot Rides

uggh, wrong board, can I get a move to the hack section??

Joachim Müller

You can't start new threads on the mods/hacks board - a moderator has to approve your hack. If he/she considers your contribution worthy to be moved, it will get moved.

Hot Rides

Quote from: Joachim Müller on August 03, 2008, 11:35:42 AM
You can't start new threads on the mods/hacks board - a moderator has to approve your hack. If he/she considers your contribution worthy to be moved, it will get moved.
oh, didnt realize that