Post Views Counter - Version 1.2.6

Version Description

  • Fix: Hardcoded post_views database table prefix
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Post Views Counter
Version 1.2.6
Comparing to
See all releases

Code changes from version 1.2.5 to 1.2.6

includes/counter.php CHANGED
@@ -145,7 +145,7 @@ class Post_Views_Counter_Counter {
145
  $post = get_post( $post_id );
146
 
147
  // whether to count this post type or not
148
- if ( empty( $post_types ) || empty( $post ) || $post->post_type !== $_POST['post_type'] || ! in_array( $post->post_type, $post_types, true ) )
149
  exit;
150
 
151
  $this->check_post( $post_id );
145
  $post = get_post( $post_id );
146
 
147
  // whether to count this post type or not
148
+ if ( empty( $post_types ) || empty( $post ) || ! in_array( $post->post_type, $post_types, true ) )
149
  exit;
150
 
151
  $this->check_post( $post_id );
includes/functions.php CHANGED
@@ -195,7 +195,7 @@ if ( ! function_exists( 'pvc_get_views' ) ) {
195
 
196
  $query = "SELECT " . ( $args['fields'] === 'date=>views' ? 'pvc.period, ' : '' ) . "SUM( IFNULL( pvc.count, 0 ) ) AS post_views
197
  FROM " . $wpdb->prefix . "posts wpp
198
- LEFT JOIN wp_post_views pvc ON pvc.id = wpp.ID " . $query . "
199
  WHERE wpp.post_type = '" . $args['post_type'] . "'
200
  GROUP BY pvc.period
201
  HAVING post_views > 0";
195
 
196
  $query = "SELECT " . ( $args['fields'] === 'date=>views' ? 'pvc.period, ' : '' ) . "SUM( IFNULL( pvc.count, 0 ) ) AS post_views
197
  FROM " . $wpdb->prefix . "posts wpp
198
+ LEFT JOIN " . $wpdb->prefix . "post_views pvc ON pvc.id = wpp.ID " . $query . "
199
  WHERE wpp.post_type = '" . $args['post_type'] . "'
200
  GROUP BY pvc.period
201
  HAVING post_views > 0";
post-views-counter.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Post Views Counter
4
  Description: Post Views Counter allows you to display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
5
- Version: 1.2.5
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
@@ -31,7 +31,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
31
  * Post Views Counter final class.
32
  *
33
  * @class Post_Views_Counter
34
- * @version 1.2.5
35
  */
36
  final class Post_Views_Counter {
37
 
@@ -80,7 +80,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
80
  'link_to_post' => true,
81
  'icon_class' => 'dashicons-chart-bar'
82
  ),
83
- 'version' => '1.2.5'
84
  );
85
 
86
  /**
2
  /*
3
  Plugin Name: Post Views Counter
4
  Description: Post Views Counter allows you to display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
5
+ Version: 1.2.6
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
31
  * Post Views Counter final class.
32
  *
33
  * @class Post_Views_Counter
34
+ * @version 1.2.6
35
  */
36
  final class Post_Views_Counter {
37
 
80
  'link_to_post' => true,
81
  'icon_class' => 'dashicons-chart-bar'
82
  ),
83
+ 'version' => '1.2.6'
84
  );
85
 
86
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.dfactory.eu/
4
  Tags: counter, hits, posts, postviews, post views, views, count, statistics, stats, analytics, pageviews, tracking
5
  Requires at least: 4.0
6
  Tested up to: 4.7.2
7
- Stable tag: 1.2.5
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -19,7 +19,7 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
19
  = Features include: =
20
 
21
  * Option to select post types for which post views will be counted and displayed.
22
- * 2 methods of collecting post views data: PHP, Javascript or REST API for greater flexibility
23
  * Possibility to manually set views count for each post
24
  * Dashboard post views stats widget
25
  * Capability to query posts according to its views count
@@ -59,6 +59,9 @@ No questions yet.
59
 
60
  == Changelog ==
61
 
 
 
 
62
  = 1.2.5 =
63
  * New: REST API counter mode
64
  * New: Adjust dashboard chart colors to admin color scheme
@@ -148,7 +151,5 @@ Initial release
148
 
149
  == Upgrade Notice ==
150
 
151
- = 1.2.5 =
152
- * New: REST API counter mode
153
- * New: Adjust dashboard chart colors to admin color scheme
154
- * Tweak: Dashboard chart query optimization
4
  Tags: counter, hits, posts, postviews, post views, views, count, statistics, stats, analytics, pageviews, tracking
5
  Requires at least: 4.0
6
  Tested up to: 4.7.2
7
+ Stable tag: 1.2.6
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
19
  = Features include: =
20
 
21
  * Option to select post types for which post views will be counted and displayed.
22
+ * 3 methods of collecting post views data: PHP, Javascript or REST API for greater flexibility
23
  * Possibility to manually set views count for each post
24
  * Dashboard post views stats widget
25
  * Capability to query posts according to its views count
59
 
60
  == Changelog ==
61
 
62
+ = 1.2.6 =
63
+ * Fix: Hardcoded post_views database table prefix
64
+
65
  = 1.2.5 =
66
  * New: REST API counter mode
67
  * New: Adjust dashboard chart colors to admin color scheme
151
 
152
  == Upgrade Notice ==
153
 
154
+ = 1.2.6 =
155
+ * Fix: Hardcoded post_views database table prefix