MainWP Child Reports - Version 1.6

Version Description

  • 4-4-2017 =
  • Fixed: Select2 conflict with WooCommerce 3.0
  • Fixed: an issue with returning incorrect date range in reports
Download this release

Release Info

Developer mainwp
Plugin Icon 128x128 MainWP Child Reports
Version 1.6
Comparing to
See all releases

Code changes from version 1.5 to 1.6

includes/admin.php CHANGED
@@ -174,8 +174,8 @@ class MainWP_WP_Stream_Admin {
174
  }
175
 
176
  public static function admin_enqueue_scripts( $hook ) {
177
- wp_register_script( 'select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.min.js', array( 'jquery' ), '3.4.5', true );
178
- wp_register_style( 'select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.css', array(), '3.4.5' );
179
  wp_register_script( 'timeago', MAINWP_WP_STREAM_URL . 'ui/timeago/jquery.timeago.js', array(), '1.4.1', true );
180
 
181
  $locale = strtolower( substr( get_locale(), 0, 2 ) );
@@ -189,19 +189,21 @@ class MainWP_WP_Stream_Admin {
189
 
190
  wp_enqueue_style( 'mainwp-wp-stream-admin', MAINWP_WP_STREAM_URL . 'ui/admin.css', array(), MainWP_WP_Stream::VERSION );
191
 
192
- $script_screens = array( 'plugins.php', 'user-edit.php', 'user-new.php', 'profile.php' );
193
 
194
  if ( 'index.php' === $hook ) {
195
 
196
- } elseif ( in_array( $hook, self::$screen_id ) || in_array( $hook, $script_screens ) || $hook == 'settings_page_mainwp-reports-page' ) {
197
-
198
- wp_enqueue_script( 'select2' );
199
- wp_enqueue_style( 'select2' );
 
 
200
 
201
  wp_enqueue_script( 'timeago' );
202
  wp_enqueue_script( 'timeago-locale' );
203
 
204
- wp_enqueue_script( 'mainwp-wp-stream-admin', MAINWP_WP_STREAM_URL . 'ui/admin.js', array( 'jquery', 'select2', 'heartbeat' ), MainWP_WP_Stream::VERSION );
205
  wp_localize_script(
206
  'mainwp-wp-stream-admin',
207
  'mainwp_wp_stream',
174
  }
175
 
176
  public static function admin_enqueue_scripts( $hook ) {
177
+ // wp_register_script( 'select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.min.js', array( 'jquery' ), '3.4.5', true );
178
+ // wp_register_style( 'select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.css', array(), '3.4.5' );
179
  wp_register_script( 'timeago', MAINWP_WP_STREAM_URL . 'ui/timeago/jquery.timeago.js', array(), '1.4.1', true );
180
 
181
  $locale = strtolower( substr( get_locale(), 0, 2 ) );
189
 
190
  wp_enqueue_style( 'mainwp-wp-stream-admin', MAINWP_WP_STREAM_URL . 'ui/admin.css', array(), MainWP_WP_Stream::VERSION );
191
 
192
+ //$script_screens = array( 'plugins.php', 'user-edit.php', 'user-new.php', 'profile.php' );
193
 
194
  if ( 'index.php' === $hook ) {
195
 
196
+ } elseif ( in_array( $hook, self::$screen_id ) || $hook == 'settings_page_mainwp-reports-page' ) {
197
+ wp_register_script( 'child-report-select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.min.js', array( 'jquery' ), '3.4.5', true );
198
+ wp_register_style( 'child-report-select2', MAINWP_WP_STREAM_URL . 'ui/select2/select2.css', array(), '3.4.5' );
199
+
200
+ wp_enqueue_script( 'child-report-select2' );
201
+ wp_enqueue_style( 'child-report-select2' );
202
 
203
  wp_enqueue_script( 'timeago' );
204
  wp_enqueue_script( 'timeago-locale' );
205
 
206
+ wp_enqueue_script( 'mainwp-wp-stream-admin', MAINWP_WP_STREAM_URL . 'ui/admin.js', array( 'jquery', 'child-report-select2', 'heartbeat' ), MainWP_WP_Stream::VERSION );
207
  wp_localize_script(
208
  'mainwp-wp-stream-admin',
209
  'mainwp_wp_stream',
includes/query.php CHANGED
@@ -142,16 +142,24 @@ class MainWP_WP_Stream_Query {
142
  * PARSE DATE FILTERS
143
  */
144
  if ( isset( $args['date'] ) && !empty( $args['date'] ) ) {
145
- $where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) = %s", $args['date'] );
 
 
146
  } else {
147
  if ( isset($args['date_from']) && !empty($args['date_from']) ) {
148
- $where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) >= %s", $args['date_from'] );
 
 
149
  }
150
  if ( isset($args['date_to']) && !empty($args['date_to']) ) {
151
- $where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) <= %s", $args['date_to'] );
 
 
152
  }
153
  if ( isset($args['datetime_from']) && !empty($args['datetime_from']) ) {
154
- $where .= $wpdb->prepare( " AND $wpdb->mainwp_reports.created >= %s", $args['datetime_from'] );
 
 
155
  }
156
  }
157
 
@@ -163,7 +171,9 @@ class MainWP_WP_Stream_Query {
163
  }
164
 
165
  if ( $args['created_greater_than'] ) {
166
- $where .= $wpdb->prepare( " AND $wpdb->mainwp_reports.created > %s", date('Y-m-d H:i:s', $args['created_greater_than'] ) );
 
 
167
  }
168
 
169
  if ( $args['record__in'] ) {
142
  * PARSE DATE FILTERS
143
  */
144
  if ( isset( $args['date'] ) && !empty( $args['date'] ) ) {
145
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date'] ) ) );
146
+ //$where .= $wpdb->prepare( " AND DATE($wpdb->mainwp_reports.created) = %s", $date );
147
+ $where .= " AND (DATE($wpdb->mainwp_reports.created) = STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
148
  } else {
149
  if ( isset($args['date_from']) && !empty($args['date_from']) ) {
150
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date_from'] ) ) );
151
+ //$where .= $wpdb->prepare( " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(%s, '%Y-%m-%d %H:%i:%s'))", $date );
152
+ $where .= " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
153
  }
154
  if ( isset($args['date_to']) && !empty($args['date_to']) ) {
155
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['date_to'] ) ) );
156
+ //$where .= $wpdb->prepare( " AND ($wpdb->mainwp_reports.created <= STR_TO_DATE(%s, '%Y-%m-%d %H:%i:%s'))", $date );
157
+ $where .= " AND ($wpdb->mainwp_reports.created <= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
158
  }
159
  if ( isset($args['datetime_from']) && !empty($args['datetime_from']) ) {
160
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['datetime_from'] ) ) );
161
+ //$where .= $wpdb->prepare( " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(%s, '%Y-%m-%d %H:%i:%s'))", $args['datetime_from'] );
162
+ $where .= " AND ($wpdb->mainwp_reports.created >= STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
163
  }
164
  }
165
 
171
  }
172
 
173
  if ( $args['created_greater_than'] ) {
174
+ $date = get_gmt_from_date( date( 'Y-m-d H:i:s', strtotime( $args['created_greater_than'] ) ) );
175
+ //$where .= $wpdb->prepare( " AND $wpdb->mainwp_reports.created > %s", date('Y-m-d H:i:s', $args['created_greater_than'] ) );
176
+ $where .= " AND ($wpdb->mainwp_reports.created > STR_TO_DATE(" . $wpdb->prepare('%s', $date) . ", '%Y-%m-%d %H:%i:%s'))";
177
  }
178
 
179
  if ( $args['record__in'] ) {
mainwp-child-reports.php CHANGED
@@ -5,7 +5,7 @@
5
  Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
- Version: 1.5
9
  */
10
 
11
  /**
5
  Description: The MainWP Child Report plugin tracks Child sites for the MainWP Client Reports Extension. The plugin is only useful if you are using MainWP and the Client Reports Extension.
6
  Author: MainWP
7
  Author URI: https://mainwp.com
8
+ Version: 1.6
9
  */
10
 
11
  /**
readme.txt CHANGED
@@ -7,7 +7,7 @@ Author URI: https://mainwp.com
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
  Tested up to: 4.7.3
10
- Stable tag: 1.5
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -36,6 +36,10 @@ Credit to the [Stream Plugin](https://wordpress.org/plugins/stream/) which the M
36
 
37
  == Changelog ==
38
 
 
 
 
 
39
  = 1.5 - 3-15-2017 =
40
  * Fixed: a few typos
41
 
7
  Plugin URI: https://mainwp.com
8
  Requires at least: 3.6
9
  Tested up to: 4.7.3
10
+ Stable tag: 1.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
36
 
37
  == Changelog ==
38
 
39
+ = 1.6 - 4-4-2017 =
40
+ * Fixed: Select2 conflict with WooCommerce 3.0
41
+ * Fixed: an issue with returning incorrect date range in reports
42
+
43
  = 1.5 - 3-15-2017 =
44
  * Fixed: a few typos
45