Advanced search  

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]

Pages: [1]   Go Down

Author Topic: single vote mod fot 1.5  (Read 3214 times)

0 Members and 1 Guest are viewing this topic.

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
single vote mod fot 1.5
« on: July 05, 2010, 03:32:27 am »

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
Code: [Select]
$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


 
Code: [Select]
$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
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: single vote mod fot 1.5
« Reply #1 on: July 05, 2010, 03:35:31 am »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: single vote mod fot 1.5
« Reply #2 on: July 05, 2010, 07:25:48 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.

changing 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.

here's the gallery in question:
toimoietbebe.com/concoursphoto2/
Clickable link would be http://toimoietbebe.com/concoursphoto2/

Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: single vote mod fot 1.5
« Reply #3 on: July 05, 2010, 08:25:51 am »

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.
 
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: single vote mod fot 1.5
« Reply #4 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, i.e. the image that has got a higher total number of votes will be displayed first. That's the point, isn't it?
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: single vote mod fot 1.5
« Reply #5 on: July 05, 2010, 09:06:27 am »

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


Code: [Select]
$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]
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: single vote mod fot 1.5
« Reply #6 on: July 05, 2010, 09:44:11 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

in 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
Code: [Select]
/////////////////////////////////////////////////////////////////
//                                                             //
// 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

Removing the gallery specification seems to solve the mismatched linked files.
Erm, what?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15761
Re: single vote mod fot 1.5
« Reply #7 on: July 05, 2010, 02:40:28 pm »

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.

If two images have the same voting average, the number of votes will be taken into account afaik
That's correct:
Code: [Select]
ORDER BY pic_rating $DESC, r.votes $DESC, pid $DESC
Logged

maxxer

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: single vote mod fot 1.5
« Reply #8 on: July 05, 2010, 03:55:04 pm »

thank you very much for your replies.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 21 queries.