- fixes in conditional logic

This commit is contained in:
Yurii Nalivaiko
2018-10-01 10:24:10 +03:00
parent d9f75f7db0
commit 64c51f969b
2 changed files with 16 additions and 4 deletions
+8 -2
View File
@@ -346,7 +346,10 @@ function um_submit_form_errors_hook_( $args ) {
continue 2;
}
} elseif ( $op == 'contains' ) {
if ( strstr( $cond_value, $parent_value ) ) {
if ( is_string( $cond_value ) && strstr( $cond_value, $parent_value ) ) {
continue 2;
}
if( is_array( $cond_value ) && in_array( $parent_value, $cond_value ) ) {
continue 2;
}
}
@@ -376,7 +379,10 @@ function um_submit_form_errors_hook_( $args ) {
continue 2;
}
} elseif ( $op == 'contains' ) {
if ( ! strstr( $cond_value, $parent_value ) ) {
if ( is_string( $cond_value ) && ! strstr( $cond_value, $parent_value ) ) {
continue 2;
}
if( is_array( $cond_value ) && !in_array( $parent_value, $cond_value ) ) {
continue 2;
}
}
+8 -2
View File
@@ -405,7 +405,10 @@ function um_get_custom_field_array( $array, $fields ) {
$array['required'] = 0;
}
} elseif ( $op == 'contains' ) {
if ( strstr( $cond_value, $parent_value ) ) {
if ( is_string( $cond_value ) && strstr( $cond_value, $parent_value ) ) {
$array['required'] = 0;
}
if( is_array( $cond_value ) && in_array( $parent_value, $cond_value ) ) {
$array['required'] = 0;
}
}
@@ -435,7 +438,10 @@ function um_get_custom_field_array( $array, $fields ) {
$array['required'] = 0;
}
} elseif ( $op == 'contains' ) {
if ( ! strstr( $cond_value, $parent_value ) ) {
if( is_string( $cond_value ) && !strstr( $cond_value, $parent_value ) ) {
$array['required'] = 0;
}
if( is_array( $cond_value ) && !in_array( $parent_value, $cond_value ) ) {
$array['required'] = 0;
}
}