What is that “comment_karma” in WordPress database?
I had been curious about a field, called “comment_karma” in the WordPress database “comment” table, wondering whether I can use it to store some form of Comment Rating data so that comments can be sorted or skipped based on “comment_karma”. A little Googling got me the answer.
It turned out people were equally curious over two years ago. See http://wordpress.org/support/topic/127000?replies=5 .
The “comment_karma” field is unused. Someone even predicated: “think of it as a plugin waiting to happen.”
Well, the time has come!
Comment Rating is going to use the field to store the Likes-only, Dislikes-only, or combined votes.
Now how do I use the “comment_karma” field?
I was hoping a built-in function allows sorting or exclusion comments. Well, there is a such a function get_comments(). Unfortunately, get_comments() in wp-includes/comment.php hardcodes the ‘orderby’ field to ‘comment_date_gmt’.
Duh! How foolish is that!
So I made a request to the WordPress team. http://wordpress.org/support/topic/324882?replies=1 With my fingers crossed, this problem can be solved in a release in the near future. For now, if you want to take advantage of “comment_karma”, you’ll have to write your own database routine.
What do you think about this plan? Will it be useful? How will you use it?