single vote mod fot 1.5 single vote mod fot 1.5
 

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

single vote mod fot 1.5

Started by maxxer, July 05, 2010, 03:32:27 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

maxxer

hiya - I am doing the same thing
as descirbed in this thread in 1.5:

http://forum.coppermine-gallery.net/index.php/topic,60377.0.html

(changing star system of voting to a single 'vote' button and ranking pictures only by number of votes)...

here's the gallery in question:
toimoietbebe.com/concoursphoto2/

n I reorder the query by r.votes:

so $query = "SELECT $select_columns
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'
                AND r.votes >= '{$CONFIG['min_votes_for_rating']}'
                ORDER BY pic_rating $DESC, r.votes $DESC, pid $DESC
                $limit"; */

becomes


$query = "SELECT $select_columns
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'
                AND r.votes >= '{$CONFIG['min_votes_for_rating']}'
                ORDER BY r.votes $DESC, pid $DESC
                $limit";


It displays correctly in 'top rated' but clicking through to displayimage.php gives the wrong picture.
the way files are identified by displayimage.php is obviously not reordering.
Been scratching my head for a while on this one!
Any help grealty appreciated...

-m

maxxer

sorry, the code edits in question are in
functions.inc.php

Joachim Müller

Quote from: maxxer on July 05, 2010, 03:32:27 AM
hiya - I am doing the same thing
as descirbed in this thread in 1.5:
The voting system has changed ramatically from cpg1.4.x to cpg1.5.x, so I strongly doubt that you can apply a mod created fro cpg1.4.x to cpg1.5.x easily. With this being said, we're not fond of threads that ask how to port mods, as suggested in Don't ask for other versions.

Quote from: maxxer on July 05, 2010, 03:32:27 AMchanging star system of voting to a single 'vote' button and ranking pictures only by number of votes
I suggest changing Amount of rating stars to be used to vote to "1" and then just changing the visual representation of the rating star mechanism in a custom theme of yours.

Quote from: maxxer on July 05, 2010, 03:32:27 AMhere's the gallery in question:
toimoietbebe.com/concoursphoto2/
Clickable link would be http://toimoietbebe.com/concoursphoto2/


maxxer

Thanks for that repsonse.
   If I change the voting system to 1 star, Coppermine uses the average rating to assign, isn't that right? Which means every single image has the same value.

Am I missing the point? I was trying to get the voting system to sort by number of votes.

Joachim Müller

If two images have the same voting average, the number of votes will be taken into account afaik, i.e. the image that has got a higher total number of votes will be displayed first. That's the point, isn't it?

maxxer

Ah - yes, that was what I assumed at 1st. 
    I've just been playing with it (uploading images, voting etc, and it doesn't seem to be behaving like that. However, its possible that i've poisoned the results by switching rating systems while there are already votes).
   I should probably delete all photos and test again - will post what i've found in case someone else finds it useful :)

meanwhile,
here is an unrecommended hack (even by low standards of clean coding) for anyone who finds themselves in my position:

in themes.inc.php underneath


$target = "displayimage.php?album=$aid$cat_link$date_link&pid={$thumb['pid']}$uid_link&msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
                }

add
[code]elseif ($aid == "toprated")
                {
                    $target = "displayimage.php?$cat_link$date_link&pid={$thumb['pid']}$uid_link#top_display_media";
                }


Removing the gallery specification seems to solve the mismatched linked files. This works for me, because I'm going to only ever have 1 album functional at a time.
I hesitate to even mention this 'fix' becuase its actually breaking functinoality  - however, it does solve my immediate issue.
Mods and devs (and everyone ele, I suppose), feel free to chastise now :) [/code]

Joachim Müller

Quote from: maxxer on July 05, 2010, 09:06:27 AM
   I should probably delete all photos and test again - will post what i've found in case someone else finds it useful :)
Nonsense - just delete the votes, not all the files. Read up Reset album properties

Quote from: maxxer on July 05, 2010, 09:06:27 AMin themes.inc.php underneath
No, don't do that, under no circumstances - that's bad and silly and dangerous and definitely not what you should do! Everything that can be accomplished by editing include/themes.inc.php can be accomplished as well by editing themes/yourtheme/theme.php, that's why there is a big, bold warning in include/themes.inc.php at the very top that reads/////////////////////////////////////////////////////////////////
//                                                             //
// Do not edit this file.                                      //
// If you need to customize your theme,                        //
// edit themes/yourtheme/theme.php instead !!!                 //
// Take a look at the sample theme (themes/sample/theme.php)   //
// to get an idea what to copy into your custom theme.         //
// Really, don't edit this file! We mean it!                   //
//                                                             //
/////////////////////////////////////////////////////////////////
We put that section deliberately in to get your attention. Posting instructions here to do otherwise is just ignorant!
If you need further help on what needs to be done, read up Editing theme.php

Quote from: maxxer on July 05, 2010, 09:06:27 AMRemoving the gallery specification seems to solve the mismatched linked files.
Erm, what?

Αndré

Quote from: maxxer on July 05, 2010, 09:06:27 AM
its possible that i've poisoned the results by switching rating systems while there are already votes
Coppermine calculates the rating according to a number between 0 and 10000 and the number of voting options. If you change it from 20 stars to just 1 star, the highest number (in the database) is still 10000. If you voted not the highest available rating, you'll get something like 8000 points.

I suggest to reset all votings and just use 1 rating star as Joachim already suggested.

Quote from: Joachim Müller on July 05, 2010, 08:40:10 AM
If two images have the same voting average, the number of votes will be taken into account afaik
That's correct:
ORDER BY pic_rating $DESC, r.votes $DESC, pid $DESC

maxxer

thank you very much for your replies.