mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-13 19:56:27 +09:00
Fix search filters and multi-select fields
This commit is contained in:
+5
-3
@@ -1641,10 +1641,13 @@ class UM_Fields {
|
||||
$output .= $this->field_label($label, $key, $data);
|
||||
}
|
||||
|
||||
$use_keyword = apply_filters('um_multiselect_option_value', 0, $data['type'] );
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
$output .= '<select multiple="multiple" name="'.$key.'[]" id="'.$key.'" data-maxsize="'. $max_selections . '" data-validate="'.$validate.'" data-key="'.$key.'" class="'.$this->get_class($key, $data, $class).'" style="width: 100%" data-placeholder="'.$placeholder.'">';
|
||||
$output .= '<select multiple="multiple" name="'.$key.'[]" id="'.$key.'" data-maxsize="'. $max_selections . '" data-validate="'.$validate.'" data-key="'.$key.'" class="'.$this->get_class($key, $data, $class).' um-user-keyword_'.$use_keyword.'" style="width: 100%" data-placeholder="'.$placeholder.'">';
|
||||
|
||||
|
||||
if ( isset($options) && $options == 'builtin'){
|
||||
$options = $ultimatemember->builtin->get ( $filter );
|
||||
}
|
||||
@@ -1662,8 +1665,7 @@ class UM_Fields {
|
||||
// add an empty option!
|
||||
$output .= '<option value=""></option>';
|
||||
|
||||
$use_keyword = apply_filters('um_multiselect_option_value', 0, $data['type'] );
|
||||
|
||||
|
||||
// add options
|
||||
foreach( $options as $k => $v ) {
|
||||
|
||||
|
||||
@@ -83,8 +83,14 @@
|
||||
$operator = 'LIKE';
|
||||
}
|
||||
|
||||
if ( in_array( $ultimatemember->fields->get_field_type( $field ), array('checkbox','multiselect') ) ) {
|
||||
$arr_filter_field_types = array('checkbox','multiselect');
|
||||
$arr_field_types = apply_filters('um_search_filter_field_types', $arr_filter_field_types );
|
||||
|
||||
if ( in_array( $ultimatemember->fields->get_field_type( $field ), $arr_field_types ) ) {
|
||||
$operator = 'LIKE';
|
||||
if( ! empty( $value ) ){
|
||||
$value = serialize( strval( $value ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $value && $field != 'um_search' && $field != 'page_id' ) {
|
||||
@@ -117,6 +123,7 @@
|
||||
if ( count ($query_args['meta_query']) == 1 ) {
|
||||
unset( $query_args['meta_query'] );
|
||||
}
|
||||
|
||||
return $query_args;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user