forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Hot Rides on August 02, 2008, 03:55:33 pm

Title: Top Rated reorginazation hack
Post by: Hot Rides on August 02, 2008, 03:55:33 pm
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
Code: [Select]
             
 //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
Code: [Select]
              //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
Title: Re: Top Rated reorginazation hack
Post by: Hot Rides on August 02, 2008, 03:56:59 pm
uggh, wrong board, can I get a move to the hack section??
Title: Re: Top Rated reorginazation hack
Post by: 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.
Title: Re: Top Rated reorginazation hack
Post by: Hot Rides on August 05, 2008, 04:25:36 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