By ericwagner on
Has anybody tried to get the karma module working in 4.7? (It's only available through cvs.) Comment moderation is missing from 4.7 and the only thing that I could find that was similar to it was the karma module.
Besides a problem with the karma.css file the only other problem I am running into is that trusted users can't set the comment viewing option to hide low-rated comments. It sets itself back to showing low-rated comments no matter what is submitted. Untrusted users have low-rated comments hidden, though.
Comments
So, this is such a hack I am
So, this is such a hack I am not even going to submit it as an official patch. Also, I haven't done this before here so I may be making one more mistakes. In any case, the following patches the drupal 4.7 comments.module to allow the "Show low-rated comments" / "Hide low-rated comments" comment control to work.
This has only been lightly tested so use at your own risk:
karma.css
Also, I had to change this (in the karma.css file):
To this:
Note sure why, however, the rate button for comment ratings wouldn't display without the change (this was true in any theme I chose.)
I'll try it out this weekend
I should have some time tomorrow to give it a shot on my dev server. I'll let you know.
Installed the CVS
I've got the CVS version installed, updated my database, enabled the module, and granted access to it. There was no submit capability to go with the comment ratings, so I applied your CSS change, and that got fixed.
So now I can submit comment rating, and the stats seem to get calculated OK. Although the submission doesn't seem to update on the first try. I think it's actually getting applied to the database, but just not immediately reflected on the page with the comment. If I follow the link to the individual ratings, I see the update. However, sometimes I have to re-submit the rating, or re-fresh the page to see it there.
Under comment viewing options, I don't seem to be able to change the threaded/flat setting , the oldest/newest setting, or the Hide Low Rated setting.
Also, sometimes I only get 3 choices for ratings, sometimes 4, and sometimes 5. I can't see any pattern to it.
I'll give the rest of your patch a try later tonight, or tomorrow, and follow up.
CSS Patch
Originally, we would not need such a patch, because Mr Drumm had built in some AJAX functionality, which submitted the rating upon selection in the dropdown. Unfortunately, it does not work anymore. Have a look at the JavaScript console...
Patches to fix the immediate rating display issue
Note: This has been updated.
The following patches to karma.js and karma.module make the rating changes display immediately after they are submitted. The patches also enable AJAX (which makes the change in karma.css mentioned above unecessary.)
karma.js patch (this isn't necessary with the latest karma.js file)
karma.module patch
Note: This patch includes the fix for the missing rating option 5 mentioned below.
Unfortunately, the patch a few comments above to comment.module is still needed as there is apparently no AJAX functionality included for the "Show|Hide low-rated comments" Comment viewing options setting. This wouldn't be too difficult to include (maybe I will work on it if I have time.)
Karma rating choices
I think that the number of rating choices you get has to do with your current karma rating (I could be wrong, though.) Create several users with different karma levels (by rating each other) and see what happens.
3 and 4 options
Only trusted users may give the 0-rating. I believe there is a slight bug in the cvs version of karma.module; just set the upper bound of the array to 5 instead of 4 to make the 5-rating accessible.
My patch tool isn't working
I'm having trouble getting the GNUWin32 patch tool to take those patches. Any chance you could send me complete files?
Thanks
Sean
fyi - I'm also going to look at the Vote up/down Package. You might want to do the same. I like the binary like it/don't like it rating scheme. 5 choices takes too much thought. Also like the potential for integration with the actions module, so I can trigger things off the number of votes.
Unfortunately..
Just downloaded the Vote up/down Package and at least from the readme, it doesn't support rating comments.EDIT: nevermind. I tried out the demo, and it does support comment ratings :D
Got it
I uploaded the files, and wanted to disable the vote-up/down module, so they wouldn't interfere. But when I went to Admin>>Modules, I got:
I'll mess with it some over the next few days and post some more.
Edit: Duh- must be tired. got rid of the drupal/modules/comment.module file and it's all good. also changed karma.css back, to get rid of the 'Rate' button, since it applies the rating right away now.
Not for release
The karma module isn't finished enough for release as it requires a core patch to be able to add a comment viewing option which adds a rating threshold. It is use at your own risk.
If someone wants to officially maintain it, please contact me. FOr now it is considered unmaintained.
What is the core patch that
What is the core patch that needs to be applied? How much work remains for the comment filtering to be functional?
Try MediumVote?
Try MediumVote?
http://drupal.org/node/49767
it have nice ajax coment voting capability.
Need karma features
Unfortunately, MediumVote doesn't quite fit my needs. I need something that tracks/creates "karma" or "mojo" scores, can automatically hide low rated comments, as well as include trusted/untrusted users.
I do have the karma module working after jumping through the various hoops above. I might possibly be able to commit to maintaining karma, however, I can't make the commitment for several months.
Ideally, I think that the karma, voting, and user points modules should either all work together or be one module.
I'm looking for the same
I'm looking for the same solution. Mediumvote is not complicated to modify for this task.
But you are right - this is not a right way :) I'll try to use karma module. Thanks for the patch!
Done! :)
Tried 3 modules for this karma task:
Karma - bugy, no Ajax
MediumVote - bugy, Ajax
Vote up/down Package - works fine, nice code, Ajaxed.
So, pached this package. Result is there: http://www.photoart.lt/images/drupal.png - voting example and User statistics (status, voting). Users role (User/Editor/Admin) and status (Spamer/User/Expert/Guru) displayed.
Rather easy work for 1-2 days. Even for me (bad programmer). But I can't give my code, sorry - code is terrible and close related to my theme.
The workflow is: Install Voting API module, take vote_up_down.module and related files (png, js, css), patch this module. I recomend to crate separate table to store karma results. Something like that:
From data stored in Voting API tables calculate karma resuls (by using cron or during karma result view) and store in that table. Pass results to comment by using this function in template.php file:
Hiding low rated comments feature is not needed for my, but it is very easy to implement in this state.
Sorry for this heresys, but I hope this information could be usefull ;)
Working fine.
From the comment above, in order to get the #5 rating, I did have to change one line in karma.module, function _karma_rating_form:
Was:
Is:
All seems to be working well as far as it goes. User karma ratings are updated properly. Seems like there's room for quite a bit of customization to grant priveledges based on karma level though.
Great job.