Skip to content

Commit

Permalink
fixing sorting when filtering posts by author, status etc
Browse files Browse the repository at this point in the history
  • Loading branch information
shashachu committed Apr 11, 2024
1 parent 5ff52e4 commit 61e0a63
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions classes/em-event-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions events-manager.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: GGG Events Manager
Version: 5.9.59
Version: 5.9.591
Plugin URI: https://github.com/shashachu/ggg-events-manager/
Description: Customized version of the Events Manager plugin by Marcus Sykes, tailored towards trooping signups for the Golden Gate Garrison.
Author: Marcus Sykes, Sha Sha Chu
Expand Down Expand Up @@ -40,7 +40,7 @@
$myUpdateChecker->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
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}`
Expand Down

0 comments on commit 61e0a63

Please sign in to comment.