Fix biography field validation in profile header and forms

This commit is contained in:
champsupertramp
2016-07-29 20:06:55 +08:00
parent c2a5e502bb
commit 617642847f
+10 -6
View File
@@ -210,10 +210,14 @@
$ultimatemember->form->add_error($key, sprintf(__('Your %s must contain less than %s characters','ultimatemember'), $array['label'], $array['max_chars']) );
}
}
if ( isset( $array['html'] ) && $array['html'] == 0 ) {
if ( wp_strip_all_tags( $args[$key] ) != trim( $args[$key] ) ) {
$ultimatemember->form->add_error($key, __('You can not use HTML tags here','ultimatemember') );
$profile_show_html_bio = um_get_option('profile_show_html_bio');
if( $profile_show_html_bio == 1 && $key !== "description" ){
if ( isset( $array['html'] ) && $array['html'] == 0 ) {
if ( wp_strip_all_tags( $args[$key] ) != trim( $args[$key] ) ) {
$ultimatemember->form->add_error($key, __('You can not use HTML tags here','ultimatemember') );
}
}
}
@@ -440,8 +444,8 @@
if ( isset( $args['description'] ) ) {
$max_chars = um_get_option('profile_bio_maxchars');
if ( strlen( utf8_decode( $args['description'] ) ) > $max_chars && $max_chars ) {
$ultimatemember->form->add_error('description', sprintf(__('Your user description must contain less than %s characters','ultimatemember'), $max_chars ) );
if ( strlen( utf8_decode( $args['description'] ) ) > $max_chars && $max_chars ) {
$ultimatemember->form->add_error('description', sprintf(__('Your user description must contain less than %s characters','ultimatemember'), $max_chars ) );
}
}