Skip to content

Commit

Permalink
WPCIVIUX-176 Filter out extra fields that don't validate rather than …
Browse files Browse the repository at this point in the history
…setting null.
  • Loading branch information
agileware-fj authored and agileware-dev committed Nov 7, 2024
1 parent 2b69819 commit 9807640
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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.3
* Version: 1.20.4
* Requires at least: 5.8
* Requires PHP: 7.4
* Requires Plugins: civicrm
Expand Down
4 changes: 2 additions & 2 deletions rest/json-all-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ protected function get_events_all() {
$start_date = preg_replace("([^0-9-])", "", $_REQUEST['start_date']);
$force_login = rest_sanitize_boolean($_REQUEST['force_login'] ?? Shortcode::getDefaultForceLogin());
$redirect_after_login = esc_url($_REQUEST['redirect_after_login']);
$extra_fields = !empty($_REQUEST['extra_fields']) ? explode(',', filter_var($_REQUEST['extra_fields'], FILTER_SANITIZE_STRING)) : [];
$extra_fields = array_map( fn($field) => Civicrm_Ux_Validators::validateAPIFieldName( $field, 'extra_fields' ), $extra_fields );
$extra_fields = !empty( $_REQUEST['extra_fields'] ) ? explode( ',', $_REQUEST['extra_fields'] ) : [];
$extra_fields = array_filter($extra_fields, fn($field) => Civicrm_Ux_Validators::validateAPIFieldName( $field, 'extra_fields' ));

if(!empty($_REQUEST['colors']) && !is_array($_REQUEST['colors'])) {
$_REQUEST['colors'] = explode(',', $_REQUEST['colors']);
Expand Down

0 comments on commit 9807640

Please sign in to comment.