mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed custom callback member directories filters with child dropdown filters;
This commit is contained in:
+12
-1
@@ -658,11 +658,22 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
me.select2('destroy');
|
||||
if ( me.hasClass( 'um-s1' ) ) {
|
||||
me.select2({
|
||||
data: arr_items,
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: 10
|
||||
dropdownParent: me.parent()
|
||||
});
|
||||
} else if ( me.hasClass( 'um-s2' ) ) {
|
||||
me.select2({
|
||||
data: arr_items,
|
||||
allowClear: true,
|
||||
minimumResultsForSearch: 10,
|
||||
dropdownParent: me.parent()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( data.post.members_directory === 'yes' ) {
|
||||
me.find('option').each( function() {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1465,11 +1465,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*
|
||||
* @return array $arr_options
|
||||
*/
|
||||
function get_options_from_callback( $data, $type ) {
|
||||
public function get_options_from_callback( $data, $type ) {
|
||||
$arr_options = array();
|
||||
|
||||
if ( in_array( $type, array( 'select', 'multiselect' ) ) && ! empty( $data['custom_dropdown_options_source'] ) ) {
|
||||
|
||||
if ( ! empty( $data['custom_dropdown_options_source'] ) && in_array( $type, array( 'select', 'multiselect' ), true ) ) {
|
||||
if ( $this->is_source_blacklisted( $data['custom_dropdown_options_source'] ) ) {
|
||||
return $arr_options;
|
||||
}
|
||||
@@ -1481,7 +1480,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$arr_options = call_user_func( $data['custom_dropdown_options_source'] );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $arr_options;
|
||||
|
||||
@@ -181,7 +181,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
);
|
||||
|
||||
if ( ! empty( $values_array ) ) {
|
||||
$parent_dropdown = isset( $arr_options['field']['parent_dropdown_relationship'] ) ? $arr_options['field']['parent_dropdown_relationship'] : '';
|
||||
$parent_dropdown = isset( $arr_options['post']['parent_option_name'] ) ? $arr_options['post']['parent_option_name'] : '';
|
||||
$arr_options['items'] = call_user_func( $ajax_source_func, $parent_dropdown );
|
||||
|
||||
if ( array_keys( $arr_options['items'] ) !== range( 0, count( $arr_options['items'] ) - 1 ) ) {
|
||||
|
||||
@@ -641,7 +641,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$values_array = ( ! empty( $users_roles['avail_roles'] ) && is_array( $users_roles['avail_roles'] ) ) ? array_keys( array_filter( $users_roles['avail_roles'] ) ) : array();
|
||||
}
|
||||
|
||||
if ( ! empty( $values_array ) && in_array( $attrs['type'], array( 'select', 'multiselect', 'checkbox', 'radio' ) ) ) {
|
||||
if ( ! empty( $values_array ) && in_array( $attrs['type'], array( 'select', 'multiselect', 'checkbox', 'radio' ), true ) ) {
|
||||
$values_array = array_map( 'maybe_unserialize', $values_array );
|
||||
$temp_values = array();
|
||||
foreach ( $values_array as $values ) {
|
||||
@@ -654,7 +654,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$values_array = array_unique( $temp_values );
|
||||
}
|
||||
|
||||
if ( $attrs['metakey'] != 'online_status' && empty( $values_array ) ) {
|
||||
if ( 'online_status' !== $attrs['metakey'] && empty( $values_array ) ) {
|
||||
ob_get_clean();
|
||||
return '';
|
||||
}
|
||||
@@ -721,7 +721,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
$attrs['options'] = apply_filters( 'um_member_directory_filter_select_options', $attrs['options'], $values_array, $attrs );
|
||||
|
||||
if ( empty( $attrs['options'] ) || ! is_array( $attrs['options'] ) ) {
|
||||
if ( ( empty( $attrs['options'] ) || ! is_array( $attrs['options'] ) ) && ! ( ! empty( $attrs['custom_dropdown_options_source'] ) && ! empty( $attrs['parent_dropdown_relationship'] ) ) ) {
|
||||
ob_get_clean();
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user