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: Edit Rating within 5 minutes.  (Read 3565 times)

0 Members and 1 Guest are viewing this topic.

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Edit Rating within 5 minutes.
« on: February 01, 2009, 01:38:14 pm »

Hi guys,

Had one or two members clicking the wrong rating for the pics, and then can't change their minds, (no edit rating function).  So not to leave them feeling guilty,  Is there a way to set a edit time, say five minutes?  so they can change the rating they gave.

Any help would be appreciated.
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

  • Guest
Re: Edit Rating within 5 minutes.
« Reply #1 on: February 01, 2009, 04:47:41 pm »

Change ratepic.php

Code: [Select]
$sql = "SELECT * " . "FROM {$CONFIG['TABLE_VOTES']} " . "WHERE pic_id = '$pic' AND user_md5_id = '$user_md5_id'";

Make that something like this:

Code: [Select]
$sql = "SELECT * " . "FROM {$CONFIG['TABLE_VOTES']} " . "WHERE pic_id = '$pic' AND user_md5_id = '$user_md5_id' AND vote_time < UNIX_TIMESTAMP() - 5 * 60";
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Edit Rating within 5 minutes.
« Reply #2 on: February 01, 2009, 05:25:09 pm »

Change ratepic.php

Code: [Select]
$sql = "SELECT * " . "FROM {$CONFIG['TABLE_VOTES']} " . "WHERE pic_id = '$pic' AND user_md5_id = '$user_md5_id'";

Make that something like this:

Code: [Select]
$sql = "SELECT * " . "FROM {$CONFIG['TABLE_VOTES']} " . "WHERE pic_id = '$pic' AND user_md5_id = '$user_md5_id' AND vote_time < UNIX_TIMESTAMP() - 5 * 60";

Thanks Nibbler.

Just tried changing the code you gave me, but if I vote on a pic that goes ok.  If I click on the rating to change it it gives me the error below,

"Critical error
There was an error while processing a database query"

I did this three times, and now the image has three votes, all from me.  Any ideas? 


Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

  • Guest
Re: Edit Rating within 5 minutes.
« Reply #3 on: February 01, 2009, 05:32:20 pm »

Enable debug mode in config and post the mysql error message you get when you try to vote.
Logged

Nibbler

  • Guest
Re: Edit Rating within 5 minutes.
« Reply #4 on: February 01, 2009, 05:38:27 pm »

Oh, change

Code: [Select]
$sql = "INSERT INTO {$CONFIG['TABLE_VOTES']} " . "VALUES ('$pic', '$user_md5_id', '$curr_time')";

to

Code: [Select]
$sql = "REPLACE INTO {$CONFIG['TABLE_VOTES']} " . "VALUES ('$pic', '$user_md5_id', '$curr_time')";
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Edit Rating within 5 minutes.
« Reply #5 on: February 01, 2009, 05:51:49 pm »

Thanks again Nibbler, that has fixed the error, but it's still counting each edit as an additional vote.   ;)  I voted, then changed the vote, and now it has two votes. by me.
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Edit Rating within 5 minutes.
« Reply #6 on: February 02, 2009, 05:54:55 pm »

I seem to have been left in the middle of this.  :-[

Got any more thoughts on a solution please,  Nibbler?
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

  • Guest
Re: Edit Rating within 5 minutes.
« Reply #7 on: February 02, 2009, 08:04:27 pm »

Sorry. It's not the easy change I thought it was going to be.
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Edit Rating within 5 minutes.
« Reply #8 on: February 02, 2009, 11:19:27 pm »

Thanks trying Nibbler, should I give up on this? or are you working on a solution. 

Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

  • Guest
Re: Edit Rating within 5 minutes.
« Reply #9 on: February 03, 2009, 01:11:18 am »

Not working on it. You'd need to store what the original rating was (Coppermine doesn't do this) in order to recalculate the rating when the vote is edited. This is more effort that it's worth I think.
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Edit Rating within 5 minutes.
« Reply #10 on: February 03, 2009, 10:05:04 am »

OK Nibbler, thanks for trying.  ;)

I'll restore the ratepic.php code back to it's original.   Might be a good idea to include this function in future releases, if that would be easier.

Cheers.
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Edit Rating within 5 minutes.
« Reply #11 on: February 04, 2009, 12:32:39 pm »

I strongly doubt that a feature to undo someone's rating within a certain period will go into the release. Much ado about nothing if you ask me.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.