Comment Rating Pro

Comment Rating Pro WordPress plugin is the advanced version of the popular Comment Rating plugin.  The Pro version was created to help those demanding for more features and customization flexibility.  It has all the functionality of the standard version, and the following features.

  • Styling comment image and text with a CSS class
  • Disabling voting restrictions, i.e. disabling one-vote-per-IP-address and allow unrestricted voting
  • Additional functions to retrieve comments ordered by their ratings
  • Additional icons to make your blog unique

For the same reasons, I also created Comment Rating Widget Pro with the feature:

  • Allows ordering comments by Comment Rating in the last X days on a sidebar.

To obtain both Comment Rating Pro and Comment Rating Widget Pro plugins, please donate $20.  After donation, please follow the Paypal link returning to my site for the download page.

The Pro version option page can be seen here.

Comment Rating Pro Customization Guide

This is a brief guide to customize using the Comment Rating Pro’s internal functions.  These functions are accessible globaly as soon as the plugin is enabled.

CSS based styling

If you want to style the comment images and text, you can define a CSS class in your theme style file (style.css) with  “CommentRating” class.  For example, the following will show the comment rating images and text on the right.

 .CommentRating {
      text-align: right;
      float: right;
 }

To access the ratings of a comment

To avoid duplicated database access, Comment Rating use an cache “$ck_cache” hash array, defined as,

$ck_cache = array('ck_ips'=>"",
                  'ck_comment_id'=>0,
                  'ck_rating_up'=>0,
                  'ck_rating_down'=>0);

You should use it as a global variable. Here’s the sample code.

global $ck_cache;
ckrating_get_rating($comment_ID);

Then, all the related content will be accessible.

 $ck_cache['ck_comment_id']
 $ck_cache['ck_ips']
 $ck_cache['ck_rating_up']
 $ck_cache['ck_rating_down']

Tight integration

If you want to do tight integration with your theme in placement and style, you will need to insert the following  line into your theme “comments.php” file within the comment loop.

<?php  if(function_exists(ckrating_display_karma))
       { ckrating_display_karma(); } ?>

Order comments by their ratings

If you want to be  adventurous in displaying comments in a post, you can use comment rating value to order the comments. This is done sorting based on the “comment_karma” field in the Wordpress “comment” table. Two things need to be done.

  1. Choose the comment rating value. The value for “comment_karma” field can take three options, i.e. Likes, Dislikes or Both. This is configured in “Comment Rating Pro Options” page, “Advanced Options”.
  2. Modify your theme’s “comments.php” file to change how comments are sorted.

If your theme does NOT use the new wp_list_comments() function (see this post
to understand what wp_list_comments() do). Then use the Comment Rating Pro’s function ckrating_get_comment() to retrieve comments in a certain sorting order for the current post.

   $post_id = $post->ID;
   $comments = ckrating_get_comments(
      "post_id=$post_id&orderby=comment_karma&order=DESC");
   foreach($comments as $comm) :
// Now display the comment detail.  Here in a grossly simplified way
  echo($comm->comment_author);
  echo($comm->comment_time);
  echo($comm->comment_text);
      // etc. etc. ...
   endforeach;

If your theme uses wp_list_comments(), I haven’t figure out how to modify it.  The flexibility offered by wp_list_comments() is too limited to allow customization.

Comment Rating Widget Faq

Do I need both Get Recent Comment and Comment Rating Widget plugins?

No you don’t.  You only need to have Comment Rating Widget activated.  If you keep both plugin activated, there will be a conflict.

In fact, if you had Get Recent Comment installed before, you need to click the “Reset template to default” to get the Comment Rating Widget template.

I cannot see the Comment Rating images/votes on my sidebar.

Please check the Comment Rating Widget option page, the default template should look like the following.

<li><a href=”%comment_link” title=”%post_title, %post_date”>%comment_author</a>: %comment_excerpt %comment_rating</li>

If not, please  click the “Reset template to default” to get the Comment Rating Widget template.

How do I control the displayed image and rating in the widget?

The comment rating and images on display can be “Likes only”, “Dislikes only”, or Both.  This is customizable by the “Value for comment_karma” option in Comment Rating (under Advanced Option).

I made the change to the Comment Rating “Value for comment_karma”, but there’s no change on the sidebar.

The plugin comes with an internal cache to reduce performance impact on page loading.  You have to clean the cache by clicking on Comment Rating Widget option “Update recent comment options” at the bottom.

If the Comment Rating plugin is not installed, will this widget still work?

Yes, this plug in will function exactly as “Get Recent Comment”.

Comment Rating Widget

I was urged by many users of Comment Rating to create a widget displaying Comment Rating results along with the comments on sidebars. Instead of reinventing the wheel, I chose to build the widget upon Krischan Jodies’ popular and stable “Get Recent Comment” widget. All the features of “Get Recent Comment” remain as is. The “Comment Rating Widget” plugin will track the most recent release “Get Recent Comment”.

This plugin is an add on to the Comment Rating plugin (version 2.9.0 or later). It displays ratings along with the most recent comments in the sidebar in formats of your design. The comment rating and images on display can be “Likes only”, “Dislikes only”, or Both. This is customizable by the “Value for comment_karma” option in Comment Rating.

The Pro version of the plugin can display comments ordered by their Comment Rating in the last X days. If you’re interested, please donate to get Comment Rating Widget Pro.

The plugin also comes with an internal cache to reduce performance impact on page loading.

If the Comment Rating plugin is not present, this plug in will function exactly as “Get Recent Comment”.

The following is Krischan Jodies’ description of Get Recent Comment.

This plugin shows excerpts of the latest comments and/or trackbacks in your sidebar. You have comprehensive control about their appearance. This ranges from the number of comments, the length of the excerpts up to the html layout. You can let the plugin order the comments by the orresponding post, or simply order them by date. The plugin can (optionally) separate the trackbacks/pingbacks from the comments. It can ignore comments to certain categories, and it offers support for gravatars. It only gives extra work to the database, when actually a new comment arrived. You can filter out unwanted pingbacks, which originate from your own blog. And it is a widget.

Feature List

  • The Pro version allows ordering by Comment Rating in the last X days on a sidebar. If you’re interested, please donate to get Comment Rating Widget Pro.
  • Highly configurable via WordPress admin interface.
  • Adjustable layout by macros.
  • Handles trackbacks and comments in separate lists, or in one combined list.
  • Widget support
  • Caches the output
  • Order comments by date, or by posting
  • Support for Gravatars
  • Option to exclude comments to posts in certain categories
  • Doesn’t show pingbacks originating from own blog

You can download the latest version here.

download

Installation

  1. After download the plug in, you can upload and install it from Wordpress Dashboard -> Plugins -> Add New. Alternatively, you can unpack and upload the dir with files to the wp-content/plugins folder on your blog.
  2. Activate the plugin.
  3. You also need to install Comment Rating plugin version 2.9.0 or later. If the Comment Rating plugin is not present, this plug in will function exactly as “Get Recent Comment”.
  4. Now you need to add the widget to your sidebar. Go to Appearance -> Widgets and drag the “Comment Rating Widget” the desired sidebar.
  5. You can configure the options under Setting -> Comment Rating Widget. The default options should be good enough.
  6. The comment rating and images on display can be “Likes only”, “Dislikes only”, or Both. This is customizable by the “Value for comment_karma” option in Comment Rating (under Advanced Option).

Older Posts »