Fix: User Registration email messages lose line breaks on save (EVF-2723) - #1644
Open
rajatgautam755421 wants to merge 1 commit into
Open
Fix: User Registration email messages lose line breaks on save (EVF-2723)#1644rajatgautam755421 wants to merge 1 commit into
rajatgautam755421 wants to merge 1 commit into
Conversation
evf_sanitize_builder() only ran wp_kses_post() (which keeps newlines) for a
fixed allowlist of message field name patterns (evf_email_message,
telegram_message, slack_message, calculation_field); anything else fell
through to sanitize_text_field(), which collapses line breaks into spaces.
everest-forms-pro's new per-form User Registration email template fields
(user_registration_email_{type}_message) didn't match any pattern, so a
paragraph-formatted message typed in the builder silently lost its line
breaks on every save. Extends the same allowlist this function already
uses for every other addon's message field.
Companion to themegrill/everest-forms-pro#1189.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
everest-forms-pro#1189 makes the User Registration addon's email Subject/Message customizable per form, saved through the classic builder like any other panel field. Multi-paragraph messages were silently losing their line breaks on every save —
Hi {username},\n\nWelcome!\n\nThanks!came back asHi {username}, Welcome! Thanks!.Root cause
evf_sanitize_builder()decides how to sanitize each posted field by matching its name against a fixed allowlist —evf_email_message,telegram_message,slack_message,calculation_field,successful_form_submission_messagegetwp_kses_post()(preserves line breaks); everything else falls through tosanitize_text_field(), which collapses them into single spaces. The newuser_registration_email_{type}_messagefield names don't match any existing pattern.Fix
Adds
user_registration_email_.*_messageto the same allowlist branch — the same mechanism already used for every other addon's message field, not a new pattern.Testing
Verified in the builder: typed a message with a blank line between two paragraphs into a User Registration email template, saved, reloaded — the blank line now persists. Confirmed the actual email that gets sent (via
EVF_User_Activation) also carries the intact message.Related
Companion to wpeverest/everest-forms-pro#1189 (per-form User Registration email templates) — that PR's fields are what exercise this bug. No user-facing change on its own; this only affects the new field names introduced there.