Download & Extend

Voting up/down doesn't change node or comment author karma

Project:User Karma
Version:6.x-1.0-beta1
Component:Miscellaneous
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review

Issue Summary

Voting up/down doesn't change the karma of node or comment author.

Karma changes only for the user, who gives votes.

Comments

#1

Regarding to the latest release and the issue queue. I think the module is not supported anymore.

#2

Latest -dev is from 2010-Jul-11. What does this mean for us?

#3

This is a bug, and it's easy to fix.

user_karma_receive_vote_node.module, line 139,
in function user_karma_receive_vote_node_user_karma_partial()

Old code:

<?php
 
// Return the value, multiplied by the multiplier!
 
$karma = db_result(
   
db_query(
     
$query,
     
array_merge( array($uid), $content_types_array, $value_types_array)
    )
  ) *
variable_get('user_karma_receive_vote_node_karma_multiplier', 1) ;
?>

New code:

<?php
 
// Return the value, multiplied by the multiplier!
 
$karma = db_result(
   
db_query(
     
$query,
     
array_merge($content_types_array, $value_types_array, array($uid))
    )
  ) *
variable_get('user_karma_receive_vote_node_karma_multiplier', 1) ;
?>

If you look at the SQL, the $uid has to come last, after the other parameters.

-----

(Yes I know what a patch is, but for me it is a lot faster to skip that part. Otherwise I would post only half the number of bug fixes that I do now.)

#4

Status:active» needs review

And the same for comments.
function user_karma_receive_vote_comment_user_karma_partial()
file user_karma_receive_vote_comment.module, line 143

Old:

<?php
 
// Return the value, multiplied by the multiplier!
 
$karma= db_result(
   
db_query(
     
$query,
     
array_merge( array($uid), $content_types_array, $value_types_array )
    )
  ) *
variable_get('user_karma_receive_vote_comment_karma_multiplier', 1);
?>

New (line 141):

<?php
      array_merge
($content_types_array, $value_types_array, array($uid))
?>

----

I did not check if this applies in the same way to the latest -dev release. I am using the 6.x-1.0-beta1 from November 2008.

#5

Oh wow, this is already fixed in -dev!
When will we see a new stable release with this fix?

EDIT:
Looks like the -dev has quite a lot of changes vs -alpha1.
Would it make sense to make a new 2.x branch for what is now 1.x-dev, and commit a few bug fixes to -alpha1 so it becomes 1.0-alpha2 ?
Or is -dev close to a stable release?

#6

I updated to -dev and didn't get this fix. I had to manually make the change. It does work now-- thanks for posting this.

Edited to add: I had unpacked -dev in the wrong location. It's working now.