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.
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";
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?
Enable debug mode in config and post the mysql error message you get when you try to vote.
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')";
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.
I seem to have been left in the middle of this. :-[
Got any more thoughts on a solution please, Nibbler?
Sorry. It's not the easy change I thought it was going to be.
Thanks trying Nibbler, should I give up on this? or are you working on a solution.
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.
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.
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.