Index: temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspoll.php
===================================================================
--- temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspoll.php	(revision 731)
+++ temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspoll.php	(revision 770)
@@ -149,5 +149,5 @@
 
 	// public
-	function vote($option_id, $ip, $user_id=null)
+	function vote($option_id, $ip, $user_id=null, $rating_id = 1, $comment = "")
 	{
 		if (!empty($option_id)) {
@@ -160,4 +160,6 @@
 						$log->setVar("option_id", $vote);
 						$log->setVar("ip", $ip);
+						$log->setVar("rating_id", $rating_id);
+						$log->setVar("comment", $comment);
 						if ( isset($user_id) ) {
 							$log->setVar("user_id", $user_id);
@@ -165,5 +167,5 @@
 						if(!$log->store()) {
 						} else {
-							$option->updateCount();
+							$option->updateCount($rating_id);
 						}
 					}
@@ -176,9 +178,11 @@
 					$log->setVar("option_id", $option_id);
 					$log->setVar("ip", $ip);
+					$log->setVar("rating_id", $rating_id);
+					$log->setVar("comment", $comment);
 					if ( isset($user_id) ) {
 						$log->setVar("user_id", $user_id);
 					}
 					$log->store();
-					$option->updateCount();
+					$option->updateCount($rating_id);
 				}
 			}
Index: temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolllog.php
===================================================================
--- temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolllog.php	(revision 405)
+++ temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolllog.php	(revision 770)
@@ -45,4 +45,6 @@
 		$this->initVar("user_id", XOBJ_DTYPE_INT, 0);
 		$this->initVar("time", XOBJ_DTYPE_INT, null);
+		$this->initVar("rating_id", XOBJ_DTYPE_INT, null);
+		$this->initVar("comment", XOBJ_DTYPE_TXTAREA, null);
 		if ( !empty($id) ) {
 			if ( is_array($id) ) {
@@ -63,6 +65,7 @@
 			$$k = $v;
 		}
+
 		$log_id = $this->db->genId($this->db->prefix("xoopspoll_log")."_log_id_seq");
-		$sql = "INSERT INTO ".$this->db->prefix("xoopspoll_log")." (log_id, poll_id, option_id, ip, user_id, time) VALUES ($log_id, $poll_id, $option_id, ".$this->db->quoteString($ip).", $user_id, ".time().")";
+		$sql = "INSERT INTO ".$this->db->prefix("xoopspoll_log")." (log_id, poll_id, option_id, ip, user_id, time, rating_id, comment) VALUES ($log_id, $poll_id, $option_id, ".$this->db->quoteString($ip).", $user_id, ".time().", $rating_id, ".$this->db->quoteString($comment).")";
 		$result = $this->db->query($sql);
 		if (!$result) {
@@ -148,7 +151,7 @@
 	{
 		$db =& Database::getInstance();
-		$sql = "SELECT DISTINCT user_id FROM ".$db->prefix("xoopspoll_log")." WHERE poll_id=".intval($poll_id)." AND user_id > 0";
+		$sql = "SELECT DISTINCT user_id FROM ".$db->prefix("xoopspoll_log")." WHERE poll_id=".intval($poll_id)." AND user_id > 0 AND rating_id = 1";
 		$users = $db->getRowsNum($db->query($sql));
-		$sql = "SELECT DISTINCT ip FROM ".$db->prefix("xoopspoll_log")." WHERE poll_id=".intval($poll_id)." AND user_id=0";
+		$sql = "SELECT DISTINCT ip FROM ".$db->prefix("xoopspoll_log")." WHERE poll_id=".intval($poll_id)." AND user_id=0 AND rating_id = 1";
 		$anons = $db->getRowsNum($db->query($sql));
 		return $users+$anons;
@@ -159,5 +162,5 @@
 	{
 		$db =& Database::getInstance();
-		$sql = "SELECT COUNT(*) FROM ".$db->prefix("xoopspoll_log")." WHERE poll_id = ".intval($poll_id);
+		$sql = "SELECT COUNT(*) FROM ".$db->prefix("xoopspoll_log")." WHERE poll_id = ".intval($poll_id)." AND rating_id = 1";
 		list($votes) = $db->fetchRow($db->query($sql));
 		return $votes;
@@ -165,8 +168,8 @@
 
 	// public static
-	function getTotalVotesByOptionId($option_id)
+	function getTotalVotesByOptionId($option_id, $rating_id)
 	{
 		$db =& Database::getInstance();
-		$sql = "SELECT COUNT(*) FROM ".$db->prefix("xoopspoll_log")." WHERE option_id = ".intval($option_id);
+		$sql = "SELECT COUNT(*) FROM ".$db->prefix("xoopspoll_log")." WHERE option_id = ".intval($option_id)." AND rating_id = $rating_id";
 		list($votes) = $db->fetchRow($db->query($sql));
 		return $votes;
Index: temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolloption.php
===================================================================
--- temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolloption.php	(revision 739)
+++ temp/test-xoops.ec-cube.net/html/modules/xoopspoll/class/xoopspolloption.php	(revision 770)
@@ -98,8 +98,14 @@
 
 	// public
-	function updateCount()
+	function updateCount($rating_id)
 	{
-		$votes = XoopsPollLog::getTotalVotesByOptionId($this->getVar("option_id"));
-		$sql ="UPDATE ".$this->db->prefix("xoopspoll_option")." SET option_count=$votes WHERE option_id=".$this->getVar("option_id")."";
+		if($rating_id == 1) {
+			$colum = "option_count";
+		} else {
+			$colum = "minus_count";
+		}
+		$votes = XoopsPollLog::getTotalVotesByOptionId($this->getVar("option_id"), $rating_id);
+		$sql ="UPDATE ".$this->db->prefix("xoopspoll_option")." SET $colum=$votes WHERE option_id=".$this->getVar("option_id")."";
+
 		$this->db->query($sql);
 	}
@@ -124,5 +130,5 @@
 		$db =& Database::getInstance();
 		$ret = array();
-		$sql = "SELECT u.uid, u.uname, l.rating_id, l.comment FROM ".$db->prefix("xoopspoll_log")." l, ". $db->prefix("users") ." u WHERE l.user_id = u.uid AND l.option_id=".intval($option_id)." ORDER BY time DESC";
+		$sql = "SELECT u.uid, u.uname, l.rating_id, l.comment FROM ".$db->prefix("xoopspoll_log")." l LEFT JOIN ". $db->prefix("users") ." u  ON l.user_id = u.uid WHERE l.option_id=".intval($option_id)." ORDER BY time DESC";
 		$result = $db->query($sql);
 		while ( $myrow = $db->fetchArray($result) ) {
