diff --git a/classes/em-event-post.php b/classes/em-event-post.php index f6c5545..5e42964 100755 --- a/classes/em-event-post.php +++ b/classes/em-event-post.php @@ -45,7 +45,7 @@ public static function init(){ public static function posts_request($request) { $hack = EM_Event_Post::should_hack_query($request); if (!empty($hack)) { - $request = preg_replace("/1=1/m", "", $request); + $request = preg_replace("/1=1\s*AND/m", "", $request); } //echo $request; return $request; @@ -97,12 +97,12 @@ public static function posts_clauses($clauses) { $order = 'DESC'; } - $where = preg_replace('/.*\(\(/sm', '', $where); - $where = preg_replace('/\)\)\)/sm', ')', $where); + $regex = '/(.*)(AND\s*\(\s*\S*\.meta_key\s*=\s*\'(_event_ec_rsvp_date|_event_rsvp_date)\'[\S\s]*AND)([\s\S]*post_type\s*=\s*\'event\'.*)/sm'; + $where = preg_replace($regex, "$1 AND $4", $where); $clauses['where'] = $where; - $clauses['join'] = 'INNER JOIN (SELECT * FROM '.$wpdb->postmeta." WHERE (meta_key='".$hack."' OR meta_key='_event_start_local') GROUP BY post_id ORDER BY meta_value ".$order.') meta on '.$wpdb->posts.'.ID = meta.post_id'; + $clauses['join'] = 'INNER JOIN (SELECT * FROM '.$wpdb->postmeta." WHERE (meta_key='".$hack."' OR meta_key='_event_start_local') GROUP BY post_id) meta on ".$wpdb->posts.'.ID = meta.post_id'; + $clauses['orderby'] = 'CAST(meta.meta_value AS DATETIME) '.$order; $clauses['groupby'] = ''; - $clauses['orderby'] = ''; } return $clauses; } diff --git a/events-manager.php b/events-manager.php index 43e63bb..794c63f 100644 --- a/events-manager.php +++ b/events-manager.php @@ -1,7 +1,7 @@ getVcsApi()->enableReleaseAssets(); // Setting constants -define('EM_VERSION', 5.959); //self expanatory +define('EM_VERSION', 5.9591); //self expanatory define('EM_PRO_MIN_VERSION', 2.64); //self expanatory define('EM_PRO_MIN_VERSION_CRITICAL', 2.377); //self expanatory define('EM_DIR', dirname( __FILE__ )); //an absolute path to this directory diff --git a/readme.txt b/readme.txt index 8adb5fa..34bdad0 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: bookings, calendar, tickets, events, buddypress, event management, google Text Domain: events-manager Requires at least: 3.5 Tested up to: 4.9.6 -Stable tag: 5.9.59 +Stable tag: 5.9.591 Fully featured event registration management including recurring events, locations management, calendar, Google map integration, booking management @@ -110,10 +110,13 @@ See our [FAQ](http://wp-events-plugin.com/documentation/faq/) page, which is upd 6. Manage attendees with various booking reports == Changelog == += 5.9.591 = +* Fixed sorting by Booking Cut-off and RSVP Date when posts are filtered by author, status etc. + = 5.9.59 = * Fixed bugs with sorting of Booking Cut-Off and RSVP Date * Updated conditionals: - * `{ggg_has_signups}` should be replaced with `{ggg_has_any_signups} + * `{ggg_has_signups}` should be replaced with `{ggg_has_any_signups}` * `{ggg_has_approved_signups}` * `{ggg_has_pending_signups}` * `{ggg_is_not_specops}`