- fixed validation on edit mode for username, username or email, password and email fields;

This commit is contained in:
nikitasinelnikov
2019-10-24 16:17:16 +03:00
parent 393cd900a8
commit 2547d54ddd
4 changed files with 92 additions and 64 deletions
+17 -3
View File
@@ -1769,6 +1769,22 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
/**
* Getting the fields that need to be disabled in edit mode (profile)
*
* @param bool $_um_profile_id
*
* @return array
*/
function get_restricted_fields_for_edit( $_um_profile_id = false ) {
// fields that need to be disabled in edit mode (profile)
$arr_restricted_fields = array( 'user_email', 'username', 'user_login', 'user_password' );
$arr_restricted_fields = apply_filters( 'um_user_profile_restricted_edit_fields', $arr_restricted_fields, $_um_profile_id );
return $arr_restricted_fields;
}
/**
* Gets a field in 'input mode'
*
@@ -1899,9 +1915,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
um_fetch_user( $_um_profile_id );
// fields that need to be disabled in edit mode (profile)
$arr_restricted_fields = array( 'user_email', 'username', 'user_login', 'user_password' );
$arr_restricted_fields = apply_filters( 'um_user_profile_restricted_edit_fields', $arr_restricted_fields, $key, $data, $_um_profile_id );
$arr_restricted_fields = $this->get_restricted_fields_for_edit( $_um_profile_id );
if ( in_array( $key, $arr_restricted_fields ) && $this->editing == true && $this->set_mode == 'profile' ) {
return;
}