fix postmeta when field = 0

This commit is contained in:
andrewshuba
2019-02-28 16:11:43 +02:00
parent d2bdba2f6d
commit 8acf91dc9d
2 changed files with 8 additions and 3 deletions
+5 -1
View File
@@ -1672,7 +1672,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
foreach ( $changes as $key => $value ) {
if ( ! in_array( $key, $this->update_user_keys ) ) {
update_user_meta( $this->id, $key, $value );
if( $value == 0 ){
update_user_meta( $this->id, $key, '0' );
} else {
update_user_meta( $this->id, $key, $value );
}
} else {
$args[ $key ] = esc_attr( $changes[ $key ] );
}
+3 -2
View File
@@ -218,6 +218,7 @@ function um_user_edit_profile( $args ) {
// loop through fields
if ( ! empty( $fields ) ) {
foreach ( $fields as $key => $array ) {
if ( ! um_can_edit_field( $array ) && isset( $array['editable'] ) && ! $array['editable'] ) {
@@ -229,6 +230,7 @@ function um_user_edit_profile( $args ) {
}
if ( isset( $args['submitted'][ $key ] ) ) {
if ( isset( $array['type'] ) && in_array( $array['type'], array( 'image', 'file' ) ) &&
( /*um_is_file_owner( UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . '/' . $args['submitted'][ $key ], um_user( 'ID' ) ) ||*/
um_is_temp_file( $args['submitted'][ $key ] ) || $args['submitted'][ $key ] == 'empty_file' ) ) {
@@ -236,14 +238,13 @@ function um_user_edit_profile( $args ) {
$files[ $key ] = $args['submitted'][ $key ];
} else {
if ( $array['type'] == 'password' ) {
$to_update[ $key ] = wp_hash_password( $args['submitted'][ $key ] );
$args['submitted'][ $key ] = sprintf( __( 'Your choosed %s', 'ultimate-member' ), $array['title'] );
} else {
if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
$to_update[ $key ] = $args['submitted'][ $key ];
} elseif ( $args['submitted'][ $key ] ) {
} elseif ( $args['submitted'][ $key ] != '' ) {
$to_update[ $key ] = $args['submitted'][ $key ];
}
}