From 0d199d5b19cd6f295a11d3489b769aebd7baa821 Mon Sep 17 00:00:00 2001 From: Champ Camba Date: Thu, 6 Aug 2020 17:58:08 +0800 Subject: [PATCH 1/2] Stop displaying error & notice when the text is empty + esc_attr $text --- includes/core/class-fields.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 826e3cf2..dd36975a 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -378,20 +378,23 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @return string */ function field_error( $text, $force_show = false ) { + + if( empty( $text ) ) return; + if ( $force_show ) { - $output = '
' . $text . '
'; + $output = '
' . esc_attr( $text ) . '
'; return $output; } if ( isset( $this->set_id ) && UM()->form()->processing == $this->set_id ) { - $output = '
' . $text . '
'; + $output = '
' . esc_attr( $text ) . '
'; } else { $output = ''; } if ( ! UM()->form()->processing ) { - $output = '
' . $text . '
'; + $output = '
' . esc_attr( $text ) . '
'; } return $output; @@ -407,20 +410,23 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @return string */ function field_notice( $text, $force_show = false ) { + + if( empty( $text ) ) return; + if ( $force_show ) { - $output = '
' . $text . '
'; + $output = '
' . esc_attr( $text ) . '
'; return $output; } if ( isset( $this->set_id ) && UM()->form()->processing == $this->set_id ) { - $output = '
' . $text . '
'; + $output = '
' . esc_attr( $text ) . '
'; } else { $output = ''; } if ( ! UM()->form()->processing ) { - $output = '
' . $text . '
'; + $output = '
' . esc_attr( $text ) . '
'; } return $output; From 419b22dedfc3c8d2a67cba381dfb5ce7f18f450b Mon Sep 17 00:00:00 2001 From: denisbaranov Date: Thu, 6 Aug 2020 15:12:50 +0300 Subject: [PATCH 2/2] Fixed: Admin filtering by the 'user_registered' --- includes/core/class-member-directory-meta.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/core/class-member-directory-meta.php b/includes/core/class-member-directory-meta.php index 8404bdef..1116d2af 100644 --- a/includes/core/class-member-directory-meta.php +++ b/includes/core/class-member-directory-meta.php @@ -435,12 +435,12 @@ if ( ! class_exists( 'um\core\Member_Directory_Meta' ) ) { } else { $gmt_offset = get_post_meta( $directory_data['form_id'], '_um_search_filters_gmt', true ); if ( is_numeric( $gmt_offset ) ) { - $offset = $gmt_offset; + $offset = (int) $gmt_offset; } } - $from_date = date( 'Y-m-d H:s:i', strtotime( date( 'Y-m-d H:s:i', min( $value ) ) . "+$offset hours" ) ); - $to_date = date( 'Y-m-d H:s:i', strtotime( date( 'Y-m-d H:s:i', max( $value ) ) . "+$offset hours" ) ); + $from_date = date( 'Y-m-d H:s:i', strtotime( min( $value ) ) + $offset * HOUR_IN_SECONDS ); // client time zone offset + $to_date = date( 'Y-m-d H:s:i', strtotime( max( $value ) ) + $offset * HOUR_IN_SECONDS + DAY_IN_SECONDS - 1 ); // time 23:59 $this->where_clauses[] = $wpdb->prepare( "u.user_registered BETWEEN %s AND %s", $from_date, $to_date );