Changing votes on 5 star rating

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-28-2007, 12:55 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Hello All,

I plan to use 5 star rating for my upcoming site, but is there a way to allow user to change his votes at a latter point of time.

Currently I am also struck with how to indicate the indicate the user that he has already voted and is about to change his votes by trying to click on the stars again. Any ideas to help me - pls.

Thanks for your help.
Reply With Quote
  #2 (permalink)  
Old 02-28-2007, 12:37 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Any suggestions? Currently we are forced to think into one direction, so a small diversion should help us strike a different idea.
Reply With Quote
  #3 (permalink)  
Old 02-28-2007, 12:42 PM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
Right now it works just like normal voting, if you vote you can't vote again. I would have to look into the code to see where you could possibly modify this to let users vote multiple times. The hard thing about this is that it wouldn't chang their vote, the website would increase the vote count as if another person voted. So their needs to be modifications for that too if you want to let users change their vote.

The 5 star rating should already change the colors of the stars for when people have already voted on something. I haven't tested it in a long time so maybe it doesn't work anymore but it should.
Reply With Quote
  #4 (permalink)  
Old 02-28-2007, 12:48 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Thanks for replying.

The color indication is working, was wondering if we could identify the votes of the particular user and change it directly into the DB.

But my site is planned to have anonymous voting - which would complicate the issues further (but I can disable it for now).
Reply With Quote
  #5 (permalink)  
Old 03-01-2007, 08:50 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
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.
Reply With Quote
  #6 (permalink)  
Old 06-01-2007, 11:51 AM
Casual Pligger
 
Join Date: May 2007
Posts: 30
Any news on this? I am interested in allowing users to change their vote later. Say, I like the story at first and give it a five. Then I read more or think about it more and want to give it 3 stars. An example of this is how the star ratings work on Google Video pages.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Star rating (developer knowledge required) bobbymoore Questions and Comments 2 10-06-2009 05:47 PM
Star rating images? PurpleCow Questions and Comments 2 06-17-2007 03:30 AM
Average Star Rating aaronpais Questions and Comments 0 05-20-2007 11:38 AM
star rating bug boardsource Questions and Comments 6 05-16-2007 11:10 AM
Star Rating System Aqui Questions and Comments 1 01-24-2007 01:30 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development