From 7a469ee53a8eeb4b82d0ca2a0a8d3ad7cbcba8eb Mon Sep 17 00:00:00 2001 From: Champ Camba Date: Sat, 31 Aug 2019 22:10:01 +0800 Subject: [PATCH] Fix dropdown callback function issue on registration --- includes/core/class-fields.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index b3c6d17c..a49c4169 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -2643,14 +2643,33 @@ if ( ! class_exists( 'um\core\Fields' ) ) { um_user( $data['parent_dropdown_relationship'] ) ) { $options = call_user_func( $data['custom_dropdown_options_source'], $data['parent_dropdown_relationship'] ); + + $disabled_by_parent_option = ''; if ( um_user( $form_key ) ) { $select_original_option_value = " data-um-original-value='" . um_user( $form_key ) . "' "; } + + } } + // Child dropdown option selected + if( isset( UM()->form()->post_form[ $form_key ] ) ){ + $select_original_option_value = " data-um-original-value='" . esc_attr( UM()->form()->post_form[ $form_key ] ) . "' "; + } + + // Child dropdown + if( $has_parent_option ){ + + if ( ! empty( $data['custom_dropdown_options_source'] ) && $has_parent_option && function_exists( $data['custom_dropdown_options_source'] ) && + isset( UM()->form()->post_form[ $form_key ] ) + ) { + $options = call_user_func( $data['custom_dropdown_options_source'], $data['parent_dropdown_relationship'] ); + } + } + if ( ! empty( $data['custom_dropdown_options_source'] ) ) { /**