- wpcs;
This commit is contained in:
Mykyta Synelnikov
2023-11-21 15:28:20 +02:00
parent 57fc9fda0a
commit 5d750f35dc
3 changed files with 9 additions and 9 deletions
+7 -7
View File
@@ -849,8 +849,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
// normal state // normal state
if ( isset( UM()->form()->post_form[ $key ] ) ) { if ( isset( UM()->form()->post_form[ $key ] ) ) {
//show empty value for password fields // Show empty value for password fields.
if ( strstr( $key, 'user_pass' ) && $this->set_mode != 'password' ) { if ( 'password' !== $this->set_mode && false !== strpos( $key, 'user_pass' ) ) {
return ''; return '';
} }
@@ -862,10 +862,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
return stripslashes_deep( UM()->form()->post_form[ $key ] ); return stripslashes_deep( UM()->form()->post_form[ $key ] );
} elseif ( um_user( $key ) && true === $this->editing ) { } elseif ( true === $this->editing && um_user( $key ) ) {
//show empty value for password fields // Show empty value for password fields.
if ( strstr( $key, 'user_pass' ) || $type == 'password' ) { if ( 'password' === $type || false !== strpos( $key, 'user_pass' ) ) {
return ''; return '';
} }
@@ -915,7 +915,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*/ */
$value = apply_filters( "um_edit_{$type}_field_value", $value, $key ); $value = apply_filters( "um_edit_{$type}_field_value", $value, $key );
} elseif ( ( um_user( $key ) || isset( $data['show_anyway'] ) ) && true === $this->viewing ) { } elseif ( true === $this->viewing && ( um_user( $key ) || isset( $data['show_anyway'] ) ) ) {
return um_filtered_value( $key, $data ); return um_filtered_value( $key, $data );
@@ -4432,7 +4432,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$id_attr = ' id="' . esc_attr( $key . UM()->form()->form_suffix ) . '"'; $id_attr = ' id="' . esc_attr( $key . UM()->form()->form_suffix ) . '"';
} }
if ( empty( $res ) ) { if ( empty( $res ) && ! ( 'number' === $type && '' !== $res ) ) {
$output = ''; $output = '';
} else { } else {
$output .= '<div class="um-field-area">'; $output .= '<div class="um-field-area">';
+1 -1
View File
@@ -752,7 +752,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
$form[ $k ] = apply_filters( 'um_sanitize_form_field', $form[ $k ], $field ); $form[ $k ] = apply_filters( 'um_sanitize_form_field', $form[ $k ], $field );
break; break;
case 'number': case 'number':
$form[ $k ] = (int) $form[ $k ]; $form[ $k ] = '' !== $form[ $k ] ? (int) $form[ $k ] : '';
break; break;
case 'textarea': case 'textarea':
if ( ! empty( $field['html'] ) || ( UM()->profile()->get_show_bio_key( $form ) === $k && UM()->options()->get( 'profile_show_html_bio' ) ) ) { if ( ! empty( $field['html'] ) || ( UM()->profile()->get_show_bio_key( $form ) === $k && UM()->options()->get( 'profile_show_html_bio' ) ) ) {
+1 -1
View File
@@ -514,7 +514,7 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
} }
// Validate the Required condition for the Number field. Set the Minimum Number option to allow 0 value. // Validate the Required condition for the Number field. Set the Minimum Number option to allow 0 value.
if ( isset( $array['type'] ) && 'number' === $array['type'] && ! isset( $array['min'] ) && ! empty( $array['required'] ) && empty( $submitted_data[ $key ] ) ) { if ( isset( $array['type'] ) && 'number' === $array['type'] && ! empty( $array['required'] ) && '' === $submitted_data[ $key ] ) {
// translators: %s: title. // translators: %s: title.
UM()->form()->add_error( $key, sprintf( __( '%s is required.', 'ultimate-member' ), $array['title'] ) ); UM()->form()->add_error( $key, sprintf( __( '%s is required.', 'ultimate-member' ), $array['title'] ) );
} }