Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Top Rated reorginazation hack  (Read 2754 times)

0 Members and 1 Guest are viewing this topic.

Hot Rides

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 108
  • I am
    • Hot Rides Show & Cruise
Top Rated reorginazation hack
« 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
Logged

Hot Rides

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 108
  • I am
    • Hot Rides Show & Cruise
Re: Top Rated reorginazation hack
« Reply #1 on: August 02, 2008, 03:56:59 pm »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Top Rated reorginazation hack
« Reply #2 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.
Logged

Hot Rides

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 108
  • I am
    • Hot Rides Show & Cruise
Re: Top Rated reorginazation hack
« Reply #3 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
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 20 queries.