mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-19 14:43:49 +09:00
add condition logic and/or in admin, fix logic in front, fix condition required fields in edit profile
This commit is contained in:
@@ -202,12 +202,16 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
unset( $condition_fields[ $key ][ $deleted_field ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_compare' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ][ 'conditional_group' . $deleted_field_id ] );
|
||||
unset( $condition_fields[ $key ]['conditions'][ $arr_id ] );
|
||||
|
||||
unset( $fields[ $key ][ 'conditional_action' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ $deleted_field ] );
|
||||
unset( $fields[ $key ][ 'conditional_operator' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ 'conditional_value' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ 'conditional_compare' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ][ 'conditional_group' . $deleted_field_id ] );
|
||||
unset( $fields[ $key ]['conditions'][ $arr_id ] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,63 +327,63 @@ function um_submit_form_errors_hook_( $args ) {
|
||||
}
|
||||
} elseif ( $op == 'not empty' ) {
|
||||
if ( ! empty( $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'equals to' ) {
|
||||
if ( $cond_value == $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'not equals' ) {
|
||||
if ( $cond_value != $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'greater than' ) {
|
||||
if ( $cond_value > $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'less than' ) {
|
||||
if ( $cond_value < $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'contains' ) {
|
||||
if ( is_string( $cond_value ) && strstr( $cond_value, $parent_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
if( is_array( $cond_value ) && in_array( $parent_value, $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} elseif ( $visibility == 'show' ) {
|
||||
if ( $op == 'empty' ) {
|
||||
if ( ! empty( $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'not empty' ) {
|
||||
if ( empty( $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'equals to' ) {
|
||||
if ( $cond_value != $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'not equals' ) {
|
||||
if ( $cond_value == $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'greater than' ) {
|
||||
if ( $cond_value <= $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'less than' ) {
|
||||
if ( $cond_value >= $parent_value ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
} elseif ( $op == 'contains' ) {
|
||||
if ( is_string( $cond_value ) && ! strstr( $cond_value, $parent_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
if( is_array( $cond_value ) && !in_array( $parent_value, $cond_value ) ) {
|
||||
continue 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user