diff --git a/includes/admin/assets/js/um-admin-forms.js b/includes/admin/assets/js/um-admin-forms.js index 314d6d24..f47f8017 100644 --- a/includes/admin/assets/js/um-admin-forms.js +++ b/includes/admin/assets/js/um-admin-forms.js @@ -250,6 +250,21 @@ jQuery(document).ready( function() { '' + wp.i18n.__( 'Remove', 'ultimate-member' ) + '' + '' + '' + + '' + + '' + '' + ''; list.append( html ); diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 742e2015..2e8b66ef 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -873,6 +873,12 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { if ( isset( $item['label'] ) ) { $item['label'] = sanitize_text_field( $item['label'] ); } + if ( isset( $item['order'] ) ) { + $item['order'] = sanitize_text_field( $item['order'] ); + } + if ( isset( $item['data_type'] ) ) { + $item['data_type'] = sanitize_text_field( $item['data_type'] ); + } return $item; } else { diff --git a/includes/admin/core/class-admin-forms.php b/includes/admin/core/class-admin-forms.php index 260d29a9..c5e30524 100644 --- a/includes/admin/core/class-admin-forms.php +++ b/includes/admin/core/class-admin-forms.php @@ -1590,14 +1590,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { if ( ! empty( $values ) && is_array( $values ) ) { foreach ( $values as $k => $value ) { - $other_key = ''; + $other_key = ''; $other_label = ''; + $other_type = ''; + $other_order = ''; if ( is_array( $value ) ) { - $keys = array_keys( $value ); + $keys = array_keys( $value ); $other_key = $keys[0]; - $labels = array_values( $value ); + $labels = array_values( $value ); $other_label = $labels[0]; + $other_type = $value['type']; + $other_order = $value['order']; } else { if ( ! in_array( $value, array_keys( $field_data['options'] ) ) ) { continue; @@ -1621,12 +1625,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) { if ( $sorting ) { $html .= ''; } - $html .= " - - " . __( 'Remove', 'ultimate-member' ) . " - - - "; + $html .= ' + + ' . __( 'Remove', 'ultimate-member' ) . ' + + + + + '; } } elseif ( ! empty( $field_data['show_default_number'] ) && is_numeric( $field_data['show_default_number'] ) && $field_data['show_default_number'] > 0 ) { $i = 0; diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index 090a5bdf..448a1f75 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -210,7 +210,6 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { if ( ! empty( $value ) && in_array( $key, array( '_um_view_types', '_um_roles', '_um_roles_can_search', '_um_roles_can_filter' ), true ) ) { $value = array_keys( $value ); } elseif ( '_um_search_filters' === $key ) { - $temp_value = array(); if ( ! empty( $value ) ) { @@ -264,8 +263,17 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { if ( ! empty( $other_data[ $k ]['label'] ) ) { $metalabel = wp_strip_all_tags( $other_data[ $k ]['label'] ); } + if ( ! empty( $other_data[ $k ]['data_type'] ) ) { + $data_type = sanitize_text_field( $other_data[ $k ]['data_type'] ); + } + if ( ! empty( $other_data[ $k ]['order'] ) ) { + $order = sanitize_text_field( $other_data[ $k ]['order'] ); + } $row = array( - $metakey => ! empty( $metalabel ) ? $metalabel : $metakey, + $metakey => $metakey, + 'label' => ! empty( $metalabel ) ? $metalabel : $metakey, + 'type' => ! empty( $data_type ) ? $data_type : '', + 'order' => ! empty( $order ) ? $order : '', ); } } @@ -275,6 +283,10 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { $value = sanitize_text_field( $value ); } elseif ( '_um_sortby_custom_label' === $key ) { $value = wp_strip_all_tags( $value ); + } elseif ( '_um_sortby_custom_type' === $key ) { + $value = sanitize_text_field( $value ); + } elseif ( '_um_sortby_custom_order' === $key ) { + $value = sanitize_text_field( $value ); } }