Non required E-mail doesn't validate correctly
-
I have added extra e-mail fields to my user profile with the advanced custom field plugin. I can modify the fields find in the wordpress dashboard.
I added the following code to my theme function.php file:
add_filter( 'cuar/core/user-profile/get_profile_fields', 'pro_image_add_profile_fields'); function pro_image_add_profile_fields($default_fields){ $default_fields = array( 'account_details' => new CUAR_HeaderField( 'account_details', array( 'label' => __( 'Account details', 'cuar' ) ) ), 'user_login' => new CUAR_TextField( 'user_login', new CUAR_UserStorage(), array( 'label' => __( 'Username', 'cuar' ), 'readonly' => true, 'inline_help' => __( 'Your username cannot be changed.', 'cuar' ), 'required' => true, ) ), 'user_email' => new CUAR_EmailField( 'user_email', new CUAR_UserStorage(), array( 'label' => __( 'Primary email', 'cuar' ), 'required' => true, ) ), 'secondary_e-mail' => new CUAR_EmailField( 'secondary_e-mail', new CUAR_UserMetaStorage(), array( 'label' => __( 'Secondary email', 'cuar' ), 'required' => false, ) ), 'third_e-mail' => new CUAR_EmailField( 'third_e-mail', new CUAR_UserMetaStorage(), array( 'label' => __( 'Third email', 'cuar' ), 'required' => false, ) ), ); return $default_fields; }
When I tried to remove the value in the Third email field, I kept getting an error that the field was not a valid e-mail. Is there something I need to do to make sure that when it saves, if the value is now empty it will just put an empty value in the database?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Non required E-mail doesn't validate correctly’ is closed to new replies.