URGENT READ THIS: Karma Value not updating
glazer - June 11, 2008 - 14:02
| Project: | User Karma |
| Version: | 5.x-1.9 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I've set up the user karma module, and so far it seems great, but I can't seem to get it to update the karma values on it's own. The only way I can update the values is to click the mass-recalculation button in the admin section. I have cron set up to run once an hour, and I also set the recalculation value in the admin section to "1".
Has anyone had any luck with getting this to work?

#1
At me the same problem. In the previous version of an error was not. :(
#2
This probably isn't the "right" way to do anything, but I just added a call to user_karma_karma_mass_recalculation(); at the end of the user_karma_cron() function, and now it's recalculating the karma points every time the cron is run.
#3
Hi,
Is user_karma *really* not recalculating the user's karma unless a mass recalculation happens?
Can somebody reproduce the problem presenting a query? I did some testing, and at least on drigg.org and fsdaily.com the users' karma seems to be recalculating correctly as soon as a story is voted...
Can you provide more information? Which sub-modules are you enabling? Can you please provide *precise* procedure to reproduce the problem, showing how the database is NOT changing? (that is, query for a person's karma, vote on a story the user posted, and then running the query again).
Thanks,
Merc.
#4
Hi,
Please give this bug high priority. It really worries me.
Merc.
#5
Same problem here.
Here is my setup: (almost fresh drupal installation)
User Karma 5.x-1.9...on
User Karma - votes on comments plugin 5.x-1.9...on
(everything else off)
Extra Voting forms 5.x-1.14...on
Voting API 5.x-1.6...on
Wich information further do you want?
Kind regards and thanks/congratulations for your modules.
#6
Hi,
I am not sure how I could be any clearer.
Let me quote myself again:
---------------------------------------------
Can you provide more information? Which sub-modules are you enabling [that is, recalculation submodules)? Can you please provide *precise* procedure to reproduce the problem, showing how the database is NOT changing? (that is, query for a person's karma, vote on a story the user posted, and then running the query again).
----------------------------------------------
I wrote this message on June 14, 2008 :
"Please give this bug high priority. It really worries me."
your answer came 9 days later. I am ill right now, and about to have a 10 day blackout on the internet. This is not exactly going to help -- I had time to work on it earlier, but not now.
Important or not important, this is gonna have to wait.
Merc.
#7
Here is the step by step process:
1.- Upload modules: User Karma 5.x-1.9, Voting API 5.x-1.6, Extra Voting Forms 5.x-1.14
2.- Active them, only User Karma main module, no plugins.
3.- Configure voting api to "Tally results whenever a vote is cast"
4.- Configure extra voting forms - nodeapi to accept karma votes only for comments, Display the karma form in the links section of a comment.
That's all, no time limit or restrictions for voting. I can vote on comments and I can see the current karma result of the node. But when I go to the user profile or I consult de karma variable it doesn't change at all.
When I do a mass recalculation here is what debug says:
* Operating in off-line mode.
* DEBUG: Calculating karma (MASS) for 1
* DEBUG: In 'user_karma_calculate_karma'
* DEBUG: Total karma amount: 0
* DEBUG: User karma for 1: 0
* DEBUG: Calculating role for 1
* DEBUG: Users_t is now 2 . THis should only be calculated once.
* DEBUG: User karma for 1: 0
* DEBUG: Total karma is 0
* DEBUG: User ranking for 1: 1
* DEBUG: RB: 1
* DEBUG: RA: 1
* DEBUG: Considering role 5
* DEBUG: Variables: ,-10,0
* DEBUG: Delete is on
* DEBUG: Will compare with 'total_karma'
* DEBUG: Checked variable: 0
* DEBUG: Type is 0. Comparing 0 with and -10
* DEBUG: Calculating karma (MASS) for 2
* DEBUG: In 'user_karma_calculate_karma'
* DEBUG: Total karma amount: 0
* DEBUG: User karma for 2: 0
* DEBUG: Calculating role for 2
* DEBUG: User karma for 2: 0
* DEBUG: Total karma is 0
* DEBUG: User ranking for 2: 1
* DEBUG: RB: 1
* DEBUG: RA: 1
* DEBUG: Considering role 5
* DEBUG: Variables: ,-10,0
* DEBUG: Delete is on
* DEBUG: Will compare with 'total_karma'
* DEBUG: Checked variable: 0
* DEBUG: Type is 0. Comparing 0 with and -10
* The recalculation was done!
#8
Hi,
You need to activate teh sub-plugins of the module user-karma. Otherwise, *no* calculation will be done at all.
The user karma module comes with several plugins, which will affect the users' karma according to several types of events (votes on comments, votes on nodes, and others).
I am closing this because I am 99.5% sure this is the problem.
IF I am wrong, please reopen adding a new message, where:
* You turn Javascript off
* Enable DEBUG mode
* Vote for something for which one of the user karma plugins is meant to assign karma to the user
* Post here the results.
Merc.
#9
Hi
I can confirm that user karma is changing only after mass recalculations, not after somebody votes on user content.
At least with user_karma_receive_vote_node module.
I've created small test using simpletest module. Please, check it and you'll see where it fails.
#10
Hi,
Drupalpropjecs: are you able to send me a .db file and the theme directory? I've never used simpletest.
Also, please notice how I wrote this if you reopened the bug:
---ignored text---
IF I am wrong, please reopen adding a new message, where:
* You turn Javascript off
* Enable DEBUG mode
* Vote for something for which one of the user karma plugins is meant to assign karma to the user
* Post here the results.
---- END of ignored text ----
Thanks.
Will test it once I get back.
Merc.
#11
Hi
I've made some investigation & debugging on user_karma.module and found a mistake in user_karma_give_vote_votingapi_* functions.
I think it should be renamed:
user_karma_give_vote_votingapi_* -> user_karma_votingapi_*
Othervise they're not invoked during module_implements('votingapi_'*) as it expects it to be modulename_hook, but we are having now - modulename_give_vote_hook.
Look at my patch and let me know what you think.
#12
Hi,
I don't have access to the code right now. But... it sounds very odd. Sicjoy, can you have a look? I will be able to check in 1 week.
I just wonder how I could get this wrong.
Merc.
#13
Hi,
JESUS.
You are so damn right I just cannot believe it.
And I mean: I cannot believe it.
There are something like 5 major sites out there... and they all have this problem?!?!?!?
How did that code _ever_ work? Is anybody here accustomed to CVS enough to figure out WHEN I was enough of an idiot to make this (literally) bloody change?
Can others please confirm that by fixing the function names everything actually works?
PLEASE PLEASE PLEASE do some good amount of testing. I am shamelessly sorry for not believing the original poster.
This bug was just so big. I was looking for an ant, and was sitting right on Godzilla's foot while looking for it.
This is _urgent_ and warrants an URGENT release. Please let me know,
Merc.
#14
Hi,
I found out what I feared: it's been broken for 4 months, since the multiple-plugin-rewrite.
I have no idea, and I mean no idea, how this managed to escape a lot of religious testing I did. I mean, I spend more time testing than coding.
Everybody: please enable debugging mode, disable Javascript and make sure that things are happening right....
Merc.
#15
Hi,
I did a lot of testing, and everything seems to miraculously work.
PLEASE TEST IT.
The fix is exactly the one in #11
Marking as FIXED, but PLEASE TEST.
Merc.
#16
This begs for some simpletest tests to be written.
--sicjoy
#17
Automatically closed -- issue fixed for two weeks with no activity.