From 617642847f5ba2beae2bdfe81730c666fd2f9f78 Mon Sep 17 00:00:00 2001 From: champsupertramp Date: Fri, 29 Jul 2016 20:06:55 +0800 Subject: [PATCH] Fix biography field validation in profile header and forms --- core/um-actions-form.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/um-actions-form.php b/core/um-actions-form.php index 66a231b1..6b805ff4 100644 --- a/core/um-actions-form.php +++ b/core/um-actions-form.php @@ -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 ) ); } }