We just did this modification to the insert function in vote.php - which should allow a provision to change votes, but the javascript
:menealo(); is not calling this insert function at all (except for the first time). We could not trace execution of this function properly. it would be great if anyone who worked on it could comment on how to allow it call the insert again.
Code:
function insert() {
global $db, $the_template;
if(empty($this->ip)) {
require_once(mnminclude.'check_behind_proxy.php');
$this->ip=check_ip_behind_proxy();
}
$this->value=intval($this->value);
// check to see if user already voted for the story - if yes - update, esle insert
$asd =$db->get_var("SELECT count(*) FROM pligg_votes WHERE vote_link_id = '$this->link' and vote_user_id='$this->user'");
if($asd==0)
{
$sql="INSERT INTO " . table_votes . " (vote_type, vote_user_id, vote_link_id, vote_value, vote_ip) VALUES ('$this->type', $this->user, $this->link, $this->value, '$this->ip')";
}
else
{
$sql="UPDATE " . table_votes . " set vote_value='$this->value',vote_ip='$this->ip' WHERE vote_link_id = '$this->link' and vote_user_id='$this->user'";
}
return $db->query($sql);
} Thanks for your help.