How do I get the karma score, and only the karmascore to display on theme? This way I can make a check on the theme to process promote vs bury.
How do I get the karma score, and only the karmascore to display on theme? This way I can make a check on the theme to process promote vs bury.
Comments
Comment #1
mercmobily commentedHi,
Please use the VotingAPI to do that.
For example:
Bye,
Merc.
Comment #2
Flying Drupalist commentedThank you mercmobily, how would I adapt that to comments? Just changing node to comments seem to be insufficient.
$existing_vote_cast = votingapi_get_vote('comment', $comment->cid, 'points', 'vote', $user->uid);I get this for instance: Fatal error: Call to undefined function votingapi_get_vote() in /home2/public_html/sites/all/themes/comment.tpl.php on line 16
Comment #3
mercmobily commentedHi,
First of all, let me correct my piece of advice:
This will work if you want the comment's total count.
(sorry about that)
But... it's _really_ strange that you're given an "undefined call" for votingapi_get_vote. I am not sure why it would happen -- you do have VotingAPI installed, certainly... right?
Merc.
Comment #4
Flying Drupalist commentedHi thanks for your help. I'm getting a Fatal error: Call to undefined function votingapi_get_voting_result() in /home2/public_html/sites/all/themes/comment.tpl.php on line 2
I have votingapi installed of course, and EVF installed too :) And both works fine.
I'm probably doing something I'm not supposed to with your snippet. I just stuck it on top of my comment.tpl.php.
Comment #5
mercmobily commentedHi,
Am I going to give away the fact that I am incompetent, if I answer "I have no idea why"?!? :-/
Merc.
Comment #6
mercmobily commentedHi,
I'vee just added this to drigg's default comment template:
And it works...
Merc.
Comment #7
Flying Drupalist commentedIf you're incompetent, what does that make me? :)
This is so strange. Does it perhaps have to do with the theme? I'm using Zen... Geh :(.
I'm going to try reinstalling votingapi/eaf and see if that helps.
Comment #8
mercmobily commentedHi,
I don't think it will... but I really don't know what it could be.
And you would be surprised, how incompetent I can be. Don't underestimate yourself!
Merc.
Comment #9
Flying Drupalist commentedThank you for your help merc. On IRC after a bit of tweaking merc found an example snippet that works:
$r = votingapi_select_results( array('content_type'=>'comment', 'content_id' => $comment->cid, 'value_type' => 'points', 'tag' => 'vote', 'function' => 'sum') ); print "ehEheheh ". (int)$r[0]['value'];Comment #10
Flying Drupalist commented*doh
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.