Edit Rating within 5 minutes. Edit Rating within 5 minutes.
 

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

Edit Rating within 5 minutes.

Started by lurkalot, February 01, 2009, 01:38:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lurkalot

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.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

Change ratepic.php


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


Make that something like this:


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

lurkalot

Quote from: Nibbler on February 01, 2009, 04:47:41 PM
Change ratepic.php


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


Make that something like this:


$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? 


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

Nibbler

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

Nibbler

Oh, change


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


to


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

lurkalot

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.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

lurkalot

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

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

Nibbler

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

lurkalot

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

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

Nibbler

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.

lurkalot

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.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Joachim Müller

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.