- fixed edit "Master row" in form builder;

- maybe fixed "Confirm Password";
This commit is contained in:
Mykyta Synelnikov
2023-06-29 12:21:40 +03:00
parent 01060cecef
commit 2529a0db7f
3 changed files with 19 additions and 13 deletions
+7 -5
View File
@@ -915,11 +915,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
<p><?php esc_html_e( 'This field type is not setup correctly.', 'ultimate-member' ); ?></p>
<?php
} else {
?>
<input type="hidden" name="_in_row" id="_in_row" value="<?php echo esc_attr( $metabox->edit_array['in_row'] ); ?>" />
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo esc_attr( $metabox->edit_array['in_sub_row'] ); ?>" />
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo esc_attr( $metabox->edit_array['in_column'] ); ?>" />
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo esc_attr( $metabox->edit_array['in_group'] ); ?>" />
if ( 'row' !== $arg1 ) {
?>
<input type="hidden" name="_in_row" id="_in_row" value="<?php echo esc_attr( $metabox->edit_array['in_row'] ); ?>" />
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo esc_attr( $metabox->edit_array['in_sub_row'] ); ?>" />
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo esc_attr( $metabox->edit_array['in_column'] ); ?>" />
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo esc_attr( $metabox->edit_array['in_group'] ); ?>" />
<?php } ?>
<input type="hidden" name="_type" id="_type" value="<?php echo esc_attr( $arg1 ); ?>" />
<input type="hidden" name="post_id" id="post_id" value="<?php echo esc_attr( $arg2 ); ?>" />
<input type="hidden" name="edit_mode" id="edit_mode" value="true" />
+1 -1
View File
@@ -2530,7 +2530,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$output .= '</div>';
if ( 'login' !== $this->set_mode && isset( $data['force_confirm_pass'] ) && 1 === $data['force_confirm_pass'] ) {
if ( 'login' !== $this->set_mode && ! empty( $data['force_confirm_pass'] ) ) {
$key = 'confirm_' . $original_key;
$output .= '<div ' . $this->get_atts( $key, $classes, $conditional, $data ) . '>';
+11 -7
View File
@@ -633,18 +633,22 @@ function um_submit_form_errors_hook_( $args ) {
}
}
if ( isset( $array['force_confirm_pass'] ) && $array['force_confirm_pass'] == 1 ) {
if ( $args[ 'confirm_' . $key ] == '' && ! UM()->form()->has_error( $key ) ) {
UM()->form()->add_error( 'confirm_' . $key , __( 'Please confirm your password', 'ultimate-member' ) );
}
if ( $args[ 'confirm_' . $key ] != $args[$key] && !UM()->form()->has_error( $key ) ) {
UM()->form()->add_error( 'confirm_' . $key , __( 'Your passwords do not match', 'ultimate-member' ) );
if ( ! empty( $array['force_confirm_pass'] ) ) {
if ( ! array_key_exists( 'confirm_' . $key, $args ) && ! UM()->form()->has_error( $key ) ) {
UM()->form()->add_error( 'confirm_' . $key, __( 'Please confirm your password', 'ultimate-member' ) );
} else {
if ( '' === $args[ 'confirm_' . $key ] && ! UM()->form()->has_error( $key ) ) {
UM()->form()->add_error( 'confirm_' . $key, __( 'Please confirm your password', 'ultimate-member' ) );
}
if ( $args[ 'confirm_' . $key ] !== $args[ $key ] && ! UM()->form()->has_error( $key ) ) {
UM()->form()->add_error( 'confirm_' . $key, __( 'Your passwords do not match', 'ultimate-member' ) );
}
}
}
if ( isset( $array['min_selections'] ) && $array['min_selections'] > 0 ) {
if ( ( ! isset( $args[ $key ] ) ) || ( isset( $args[ $key ] ) && is_array( $args[ $key ] ) && count( $args[ $key ] ) < $array['min_selections'] ) ) {
UM()->form()->add_error($key, sprintf( __( 'Please select at least %s choices', 'ultimate-member' ), $array['min_selections'] ) );
UM()->form()->add_error( $key, sprintf( __( 'Please select at least %s choices', 'ultimate-member' ), $array['min_selections'] ) );
}
}