Skip to content

Commit

Permalink
WPCIVIUX-157 Fix loading image from source field
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-fj authored and agileware-dev committed Nov 5, 2024
1 parent eb3ad71 commit af47003
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion civicrm-ux.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions rest/json-all-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit af47003

Please sign in to comment.