I am trying to display both the karma rank and karma total in the comments. So far, I've been able to display the user karma rank by inserting print user_karma_user_rank(array('uid' => $comment->uid)); into my comment.tpl.php, but I can't figure out how to do the karma total.
Thanks
Comments
Comment #1
mercmobily commentedHi,
The function is user_karma_user_karma! :-D
Please confirm that this answers your question!
Merc.
Comment #2
jorgepg23 commentedI tried that function earlier and it didn't work for me. It outputs the same number for all users (the highest overall karma value on the site). In other words, it displays 87 for everybody.
I noticed that when using the devel module to see the query info for each user's profile page that it seems to be getting the karma total from the votingapi_get_vote function. The query output for this function is SELECT * FROM votingapi_vote v WHERE content_type='user' AND content_id=3 AND value_type='karma_points' AND tag='karma' AND uid=1.
Comment #3
mercmobily commentedHi,
I don't get it. The query above is actually correct: it's returning the vote given from user "1" (the karma system) to the user 3 (the user receiving the karma). It really oughtn't return 87 for everybody.
I ran this very query for Free Software Magazine and am getting normal values...
What do you get if you run:
SELECT * FROM votingapi_vote v WHERE content_type='user' AND value_type='karma_points' AND tag='karma' AND uid=1 limit 100;
...?
It's the same query, but without having the content_id constraint...
Bye,
Merc.
Comment #4
mercmobily commentedHi,
Well...?
Merc.
Comment #5
mercmobily commentedHi,
I can only assume this is fixed.
Merc.
Comment #6
mercmobily commentedComment #7
NoRandom commentedI don't know much about php, actually a little more than copy-paste, but this is working for me:
Comment #8
mercmobily commentedHi,
I am an idiot, and you are completely right.
I can be stupidly unhelpful at times.
Merc.