diff --git a/civicrm-ux.php b/civicrm-ux.php index 34f77b2..b2b709d 100644 --- a/civicrm-ux.php +++ b/civicrm-ux.php @@ -9,7 +9,7 @@ * Plugin Name: WP CiviCRM UX * Plugin URI: https://github.com/agileware/wp-civicrm-ux * Description: A better user experience for integrating WordPress and CiviCRM - * Version: 1.20.1 + * Version: 1.20.2 * Requires at least: 5.8 * Requires PHP: 7.4 * Requires Plugins: civicrm diff --git a/rest/json-all-events.php b/rest/json-all-events.php index 31b02fc..e2485f4 100644 --- a/rest/json-all-events.php +++ b/rest/json-all-events.php @@ -90,14 +90,11 @@ protected function get_events_all() { $eventQuery->addWhere('event_type_id:name', 'IN', $types); } - $image_src_field = Civicrm_Ux_Validators::validateAPIFieldName($_REQUEST['image_src_field']); - - if (!empty($_REQUEST['image_id_field'])) { - $image_id_field = Civicrm_Ux_Validators::validateAPIFieldName($_REQUEST['image_id_field']); - - $eventQuery - ->addJoin('File AS file', 'LEFT', ['file.id', '=', $image_id_field]) - ->addSelect('file.id', $image_src_field); + if(!empty($_REQUEST['image_src_field'])) { + $image_src_field = Civicrm_Ux_Validators::validateAPIFieldName($_REQUEST['image_src_field']); + $eventQuery->addSelect($image_src_field); + } else { + $image_src_field = null; } $events = $eventQuery->execute();