Strong Testimonials - Version 2.40.3

Version Description

Download this release

Release Info

Developer giucu91
Plugin Icon 128x128 Strong Testimonials
Version 2.40.3
Comparing to
See all releases

Code changes from version 2.40.2 to 2.40.3

admin/js/admin-order.js CHANGED
@@ -81,7 +81,8 @@ jQuery(document).ready(function ($) {
81
  ui.item.find(".column-handle").addClass("refresh");
82
  $.post(ajaxurl, {
83
  action: 'update-menu-order',
84
- order: $('#the-list').sortable('serialize'),
 
85
  },
86
  function (data) {
87
  // update menu order shown
81
  ui.item.find(".column-handle").addClass("refresh");
82
  $.post(ajaxurl, {
83
  action: 'update-menu-order',
84
+ posts: $('#the-list').sortable('serialize'),
85
+ order: wpmtstOrderHelper
86
  },
87
  function (data) {
88
  // update menu order shown
changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 2.40.2 - Apr. 13, 2020 =
2
  * Improved star rating display
3
  * Added another attribute to average rating shortcode
1
+ = 2.40.3 - Apr. 14, 2020 =
2
+ * Fixed fatal error on testimonials order.
3
+
4
+
5
  = 2.40.2 - Apr. 13, 2020 =
6
  * Improved star rating display
7
  * Added another attribute to average rating shortcode
includes/class-strong-testimonials-order.php CHANGED
@@ -29,7 +29,6 @@ class Strong_Testimonials_Order {
29
 
30
  add_action( 'wp_ajax_update-menu-order', array( __CLASS__, 'update_menu_order' ) );
31
 
32
- add_action( 'pre_get_posts', array( __CLASS__, 'store_query_vars' ) );
33
  add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ), 500 );
34
 
35
  add_filter( 'posts_orderby', array( __CLASS__, 'posts_orderby' ), 500, 2 );
@@ -56,27 +55,26 @@ class Strong_Testimonials_Order {
56
  return;
57
  }
58
 
 
 
 
59
  wp_enqueue_script( 'wpmtst-admin-order-script', WPMTST_ADMIN_URL . 'js/admin-order.js', array(
60
  'jquery-effects-highlight',
61
  'jquery-ui-sortable',
62
  ), null, true );
63
 
64
- wp_enqueue_style( 'wpmtst-admin-order-style', WPMTST_ADMIN_URL . '/css/order.css', array(), null );
65
-
66
- }
67
-
68
- /**
69
- * Store query vars in transient because they are not available in update_menu_order callback.
70
- */
71
- public static function store_query_vars() {
72
- if ( is_admin() ) {
73
- set_transient( 'wpmtst_order_query',
74
- array(
75
- 'paged' => get_query_var( 'paged' ),
76
- 'posts_per_page' => get_query_var( 'posts_per_page' ),
77
- ),
78
- 24 * HOUR_IN_SECONDS );
79
  }
 
 
 
 
80
  }
81
 
82
  /**
@@ -261,7 +259,7 @@ class Strong_Testimonials_Order {
261
  public static function update_menu_order() {
262
  global $wpdb;
263
 
264
- parse_str( $_POST['order'], $data );
265
  if ( ! is_array( $data ) ) {
266
  wp_die();
267
  }
@@ -270,10 +268,16 @@ class Strong_Testimonials_Order {
270
  $menu_order_arr = array();
271
 
272
  // Fetch query vars for pagination.
273
- $query_vars = get_transient( 'wpmtst_order_query' );
274
- delete_transient( 'wpmtst_order_query' );
275
- $paged = $query_vars['paged'] ? $query_vars['paged'] : 1;
276
- $posts_per_page = $query_vars['posts_per_page'];
 
 
 
 
 
 
277
 
278
  // Reorder
279
  foreach ( $id_arr as $key => $id ) {
29
 
30
  add_action( 'wp_ajax_update-menu-order', array( __CLASS__, 'update_menu_order' ) );
31
 
 
32
  add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ), 500 );
33
 
34
  add_filter( 'posts_orderby', array( __CLASS__, 'posts_orderby' ), 500, 2 );
55
  return;
56
  }
57
 
58
+ global $wp_query;
59
+
60
+ wp_enqueue_style( 'wpmtst-admin-order-style', WPMTST_ADMIN_URL . '/css/order.css', array(), null );
61
  wp_enqueue_script( 'wpmtst-admin-order-script', WPMTST_ADMIN_URL . 'js/admin-order.js', array(
62
  'jquery-effects-highlight',
63
  'jquery-ui-sortable',
64
  ), null, true );
65
 
66
+ $helper = array();
67
+ if ( isset( $wp_query ) && isset( $wp_query->query_vars ) ) {
68
+ $helper = array(
69
+ 'page' => max( 1, $wp_query->query_vars['paged'] ),
70
+ 'posts_per_page' => $wp_query->query_vars['posts_per_page']
71
+ );
72
+
 
 
 
 
 
 
 
 
73
  }
74
+ wp_localize_script( 'wpmtst-admin-order-script', 'wpmtstOrderHelper', $helper );
75
+
76
+
77
+
78
  }
79
 
80
  /**
259
  public static function update_menu_order() {
260
  global $wpdb;
261
 
262
+ parse_str( $_POST['posts'], $data );
263
  if ( ! is_array( $data ) ) {
264
  wp_die();
265
  }
268
  $menu_order_arr = array();
269
 
270
  // Fetch query vars for pagination.
271
+ $paged = 1;
272
+ $posts_per_page = 25;
273
+ if ( isset( $_POST['order'] ) ) {
274
+ if ( isset( $_POST['order']['page'] ) ) {
275
+ $paged = absint( $_POST['order']['page'] );
276
+ }
277
+ if ( isset( $_POST['order']['posts_per_page'] ) ) {
278
+ $posts_per_page = absint( $_POST['order']['posts_per_page'] );
279
+ }
280
+ }
281
 
282
  // Reorder
283
  foreach ( $id_arr as $key => $id ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: testimonials, testimonial slider, testimonial form, star ratings
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 5.2
7
- Stable tag: 2.40.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
  Tested up to: 5.2
7
+ Stable tag: 2.40.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
strong-testimonials.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Collect and display your testimonials or reviews.
6
  * Author: MachoThemes
7
  * Author URI: https://www.machothemes.com/
8
- * Version: 2.40.2
9
  * Text Domain: strong-testimonials
10
  * Domain Path: /languages
11
  * Requires: 4.6 or higher
@@ -44,7 +44,7 @@ if ( ! defined( 'ABSPATH' ) ) {
44
  exit;
45
  }
46
 
47
- define( 'WPMTST_VERSION', '2.40.2' );
48
  define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
49
  define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
50
  defined( 'WPMTST_STORE_URL' ) || define( 'WPMTST_STORE_URL', 'https://strongtestimonials.com' );
5
  * Description: Collect and display your testimonials or reviews.
6
  * Author: MachoThemes
7
  * Author URI: https://www.machothemes.com/
8
+ * Version: 2.40.3
9
  * Text Domain: strong-testimonials
10
  * Domain Path: /languages
11
  * Requires: 4.6 or higher
44
  exit;
45
  }
46
 
47
+ define( 'WPMTST_VERSION', '2.40.3' );
48
  define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
49
  define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
50
  defined( 'WPMTST_STORE_URL' ) || define( 'WPMTST_STORE_URL', 'https://strongtestimonials.com' );