kk Star Ratings - Version 1.7

Version Description

  • Update: The top rated posts now considers the vote count as well. This is a recommended update for all users.

=

Download this release

Release Info

Developer bhittani
Plugin Icon 128x128 kk Star Ratings
Version 1.7
Comparing to
See all releases

Code changes from version 1.6 to 1.7

Files changed (3) hide show
  1. admin/options.php +5 -19
  2. kk-ratings.php +4 -4
  3. readme.txt +4 -2
admin/options.php CHANGED
@@ -11,9 +11,7 @@
11
  <?php screen_icon(); ?>
12
  <form action="options.php" method="post" id=<?php echo $this->plugin_id; ?>"_options_form" name=<?php echo $this->plugin_id; ?>"_options_form">
13
  <?php settings_fields($this->plugin_id.'_options'); ?>
14
- <h2>kk Star Ratings &raquo; Settings
15
- <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like send="false" layout="button_count" width="450" show_faces="true" href="http://wakeusup.com"></fb:like>
16
- </h2>
17
  <table width="697" class="widefat" style="width:600px;">
18
  <thead>
19
     <tr>
@@ -30,11 +28,6 @@
30
  </tr>
31
  </tfoot>
32
  <tbody>
33
- <tr>
34
- <td></td>
35
- <td><a href="http://wakeusup.com/2011/05/kk-star-ratings/" target="_blank" title="View Changelog">Changelog</a></td>
36
- <td></td>
37
- </tr>
38
  <tr>
39
  <td>1</td>
40
  <td><label for="<?php echo $this->plugin_id; ?>[enable]">Enable</label></td>
@@ -63,19 +56,17 @@
63
  <br />Where $pid is the post of the id
64
  <br /><br />
65
  <strong>Get top rated posts as array of objects:</strong>
66
- <br /> <span style="color:#F60;">&lt;?php if(function_exists('kk_star_ratings_get')) : $top_rated_posts = kk_star_ratings_get($total,$cat_id); endif; ?&gt;</span>
67
- <br />Where $total is the limit (int) and $cat_id is the id of the category which is optional
68
- <br />$top_rated_posts will contain an array of objects, each containing an ID, title and ratings.
69
  <br />
70
  <strong>Example Usage:</strong>
71
  <pre>
72
  foreach($top_rated_posts as $post)
73
  {
74
- // You get $post->ID, $post->ratings and $post->post_title
75
  // Do anything with it like get_post($post->ID)
76
  // ...
77
- // The following will display the Post ID, Title and Ratings for each.
78
- echo "Post ID: ".$post->ID." | Title: ".$post->post_title." | Ratings: ".$post->ratings.'&lt;br /&gt;';
79
  }
80
  </pre>
81
  <br />
@@ -127,11 +118,6 @@
127
  <input type="checkbox" name="<?php echo $this->plugin_id; ?>[clear]" value="1" <?php echo $this->options['clear'] ? "checked='checked'" : ""; ?> />
128
  </td>
129
  </tr>
130
- <tr>
131
- <td>8</td>
132
- <td><label for="<?php echo $this->plugin_id; ?>[column]">Show rating column in the posts/pages admin screen</label></td>
133
- <td><input type="checkbox" name="<?php echo $this->plugin_id; ?>[column]" value="1" <?php echo $this->options['column'] ? "checked='checked'" : ""; ?> /></td>
134
- </tr>
135
  </tbody>
136
  </table>
137
  <p><input type="submit" name="submit" value="Save Settings" class="button" /></p>
11
  <?php screen_icon(); ?>
12
  <form action="options.php" method="post" id=<?php echo $this->plugin_id; ?>"_options_form" name=<?php echo $this->plugin_id; ?>"_options_form">
13
  <?php settings_fields($this->plugin_id.'_options'); ?>
14
+ <h2>kk Star Ratings &raquo; Settings</h2>
 
 
15
  <table width="697" class="widefat" style="width:600px;">
16
  <thead>
17
     <tr>
28
  </tr>
29
  </tfoot>
30
  <tbody>
 
 
 
 
 
31
  <tr>
32
  <td>1</td>
33
  <td><label for="<?php echo $this->plugin_id; ?>[enable]">Enable</label></td>
56
  <br />Where $pid is the post of the id
57
  <br /><br />
58
  <strong>Get top rated posts as array of objects:</strong>
59
+ <br /> <span style="color:#F60;">&lt;?php if(function_exists('kk_star_ratings_get')) : $top_rated_posts = kk_star_ratings_get($total); endif; ?&gt;</span>
60
+ <br />Where $total is the limit (int)
61
+ <br />$top_rated_posts will contain an array of objects, each containing an ID and ratings.
62
  <br />
63
  <strong>Example Usage:</strong>
64
  <pre>
65
  foreach($top_rated_posts as $post)
66
  {
67
+ // you get $post->ID and $post->ratings
68
  // Do anything with it like get_post($post->ID)
69
  // ...
 
 
70
  }
71
  </pre>
72
  <br />
118
  <input type="checkbox" name="<?php echo $this->plugin_id; ?>[clear]" value="1" <?php echo $this->options['clear'] ? "checked='checked'" : ""; ?> />
119
  </td>
120
  </tr>
 
 
 
 
 
121
  </tbody>
122
  </table>
123
  <p><input type="submit" name="submit" value="Save Settings" class="button" /></p>
kk-ratings.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: kk Star Ratings
5
  Plugin URI: http://wakeusup.com/2011/05/kk-star-ratings/
6
  Description: A clean, animated and sweat ratings feature for your blog <strong>With kk Star Ratings, you can allow your blog posts to be rated by your blog visitors</strong>. <strong>It also includes a widget</strong> which you can add to your sidebar to show the top rated post. There are some useful options you can set to customize this plugin. You can do all that after installing and activating the plugin and then visiting the <a href="options-general.php?page=kk-ratings_options">Plugin Settings</a>.
7
- Version: 1.6
8
  Author: Kamal Khan
9
  Author URI: http://bhittani.com
10
  License: GPLv2 or later
@@ -116,7 +116,7 @@ if(!class_exists('kk_Ratings') && !isset($kkratings) && !function_exists('kk_sta
116
  $this->options['show_in_pages'] = 0; // 1, 0
117
  $this->options['unique'] = 0; // 1, 0
118
  $this->options['position'] = 'top-left'; // 'top-left', 'top-right', 'bottom-left', 'bottom-right'
119
- $this->options['legend'] = '[avg]([per]) [total] votes'; // [total]=total ratings, [rating]=average, [per]=percentage
120
  $this->options['init_msg'] = 'Be the first to rate it!'; // string
121
  $this->options['column'] = 1; // 1, 0
122
  $this->update_options();
@@ -326,12 +326,12 @@ if(!class_exists('kk_Ratings') && !isset($kkratings) && !function_exists('kk_sta
326
  global $wpdb;
327
  $table = $wpdb->prefix . 'postmeta';
328
  if(!$cat)
329
- $rated_posts = $wpdb->get_results("SELECT a.ID, a.post_title, b.meta_value AS 'ratings' FROM " . $wpdb->posts . " a, $table b WHERE a.post_status='publish' AND a.ID=b.post_id AND b.meta_key='_kk_ratings_avg' ORDER BY b.meta_value DESC LIMIT $total");
330
  else
331
  {
332
  $table2 = $wpdb->prefix . 'term_taxonomy';
333
  $table3 = $wpdb->prefix . 'term_relationships';
334
- $rated_posts = $wpdb->get_results("SELECT a.ID, a.post_title, b.meta_value AS 'ratings' FROM " . $wpdb->posts . " a, $table b, $table2 c, $table3 d WHERE c.term_taxonomy_id=d.term_taxonomy_id AND c.term_id=$cat AND d.object_id=a.ID AND a.post_status='publish' AND a.ID=b.post_id AND b.meta_key='_kk_ratings_avg' ORDER BY b.meta_value DESC LIMIT $total");
335
  }
336
 
337
  return $rated_posts;
4
  Plugin Name: kk Star Ratings
5
  Plugin URI: http://wakeusup.com/2011/05/kk-star-ratings/
6
  Description: A clean, animated and sweat ratings feature for your blog <strong>With kk Star Ratings, you can allow your blog posts to be rated by your blog visitors</strong>. <strong>It also includes a widget</strong> which you can add to your sidebar to show the top rated post. There are some useful options you can set to customize this plugin. You can do all that after installing and activating the plugin and then visiting the <a href="options-general.php?page=kk-ratings_options">Plugin Settings</a>.
7
+ Version: 1.7
8
  Author: Kamal Khan
9
  Author URI: http://bhittani.com
10
  License: GPLv2 or later
116
  $this->options['show_in_pages'] = 0; // 1, 0
117
  $this->options['unique'] = 0; // 1, 0
118
  $this->options['position'] = 'top-left'; // 'top-left', 'top-right', 'bottom-left', 'bottom-right'
119
+ $this->options['legend'] = '[avg]([per]) [total] votes'; // [total]=total ratings, [avg]=average, [per]=percentage
120
  $this->options['init_msg'] = 'Be the first to rate it!'; // string
121
  $this->options['column'] = 1; // 1, 0
122
  $this->update_options();
326
  global $wpdb;
327
  $table = $wpdb->prefix . 'postmeta';
328
  if(!$cat)
329
+ $rated_posts = $wpdb->get_results("SELECT a.ID, a.post_title, b.meta_value AS 'ratings' FROM " . $wpdb->posts . " a, $table b, $table c WHERE a.post_status='publish' AND a.ID=b.post_id AND a.ID=c.post_id AND b.meta_key='_kk_ratings_avg' AND c.meta_key='_kk_ratings_casts' ORDER BY b.meta_value DESC, c.meta_value DESC LIMIT $total");
330
  else
331
  {
332
  $table2 = $wpdb->prefix . 'term_taxonomy';
333
  $table3 = $wpdb->prefix . 'term_relationships';
334
+ $rated_posts = $wpdb->get_results("SELECT a.ID, a.post_title, b.meta_value AS 'ratings' FROM " . $wpdb->posts . " a, $table b, $table2 c, $table3 d, $table e WHERE c.term_taxonomy_id=d.term_taxonomy_id AND c.term_id=$cat AND d.object_id=a.ID AND a.post_status='publish' AND a.ID=b.post_id AND a.ID=e.post_id AND b.meta_key='_kk_ratings_avg' AND e.meta_key='_kk_ratings_casts' ORDER BY b.meta_value DESC, e.meta_value DESC LIMIT $total");
335
  }
336
 
337
  return $rated_posts;
readme.txt CHANGED
@@ -9,9 +9,9 @@ Tags: star ratings, votings, rate posts, ajax ratings
9
 
10
  Requires at least: 3.0
11
 
12
- Tested up to: 3.3.1
13
 
14
- Stable tag: 1.6
15
 
16
 
17
  kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
@@ -116,5 +116,7 @@ This may have occured to some users with previous versions of the plugin. It has
116
  = 1.6 =
117
  * Added: Now you can see a column in the admin screen of posts and pages stating the ratings of each.
118
 
 
 
119
 
120
  == Upgrade Notice ==
9
 
10
  Requires at least: 3.0
11
 
12
+ Tested up to: 3.3.2
13
 
14
+ Stable tag: 1.7
15
 
16
 
17
  kk Star Ratings allows blog visitors to involve and interact more effectively with your website by rating posts.
116
  = 1.6 =
117
  * Added: Now you can see a column in the admin screen of posts and pages stating the ratings of each.
118
 
119
+ = 1.7 =
120
+ * Update: The top rated posts now considers the vote count as well. This is a recommended update for all users.
121
 
122
  == Upgrade Notice ==