From 6a937715112091de725fb55f05c920da731f391a Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Tue, 21 Jan 2020 15:13:33 +0200 Subject: [PATCH] - added fix for options if they contains spaces in the start and the end of option (added trim); --- includes/admin/core/class-admin-builder.php | 4 +++- includes/core/class-member-directory.php | 6 +++--- includes/core/um-filters-fields.php | 4 ++-- readme.txt | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php index 78f276cc..c376a7e9 100644 --- a/includes/admin/core/class-admin-builder.php +++ b/includes/admin/core/class-admin-builder.php @@ -951,7 +951,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) { -
edit_array['content']; ?>
+ +
edit_array['content'] ) ? $metabox->edit_array['content'] : ''; ?>
+ modal_header(); ?> diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index bb061286..25276107 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -609,11 +609,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { if ( $attrs['metakey'] != 'online_status' ) { if ( $attrs['metakey'] != 'role_select' && $attrs['metakey'] != 'mycred_rank' && empty( $custom_dropdown ) ) { - $attrs['options'] = array_intersect( array_map( 'stripslashes', $attrs['options'] ), $values_array ); + $attrs['options'] = array_intersect( array_map( 'stripslashes', array_map( 'trim', $attrs['options'] ) ), $values_array ); } elseif ( ! empty( $custom_dropdown ) ) { - $attrs['options'] = array_intersect_key( $attrs['options'], array_flip( $values_array ) ); + $attrs['options'] = array_intersect_key( array_map( 'trim', $attrs['options'] ), array_flip( $values_array ) ); } else { - $attrs['options'] = array_intersect_key( $attrs['options'], array_flip( $values_array ) ); + $attrs['options'] = array_intersect_key( array_map( 'trim', $attrs['options'] ), array_flip( $values_array ) ); } } diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php index 578acd2f..6e1ea3d0 100644 --- a/includes/core/um-filters-fields.php +++ b/includes/core/um-filters-fields.php @@ -709,14 +709,14 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) { } } } elseif ( 'select' == $type || 'radio' == $type ) { - if ( ! empty( $data['options'] ) && ! in_array( $value, $data['options'] ) && empty( $data['custom_dropdown_options_source'] ) ) { + if ( ! empty( $data['options'] ) && ! in_array( $value, array_map( 'trim', $data['options'] ) ) && empty( $data['custom_dropdown_options_source'] ) ) { $value = ''; } } } elseif ( ! empty( $value ) && is_array( $value ) ) { if ( 'multiselect' == $type || 'checkbox' == $type ) { if ( ! empty( $data['options'] ) && empty( $data['custom_dropdown_options_source'] ) ) { - $value = array_intersect( $value, $data['options'] ); + $value = array_intersect( $value, array_map( 'trim', $data['options'] ) ); } } } diff --git a/readme.txt b/readme.txt index 1cf52d59..4368fd34 100644 --- a/readme.txt +++ b/readme.txt @@ -145,7 +145,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat * To learn more about version 2.1 please see this [topic](https://wordpress.org/support/topic/version-2-1-4/) * UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin -= 2.1.3: January 20, 2020 = += 2.1.3: January 21, 2020 = * Enhancements: