Skip to content

Fix: User Registration email messages lose line breaks on save (EVF-2723) - #1644

Open
rajatgautam755421 wants to merge 1 commit into
pre-developfrom
fix/EVF-2723-user-registration-email-message-newlines
Open

Fix: User Registration email messages lose line breaks on save (EVF-2723)#1644
rajatgautam755421 wants to merge 1 commit into
pre-developfrom
fix/EVF-2723-user-registration-email-message-newlines

Conversation

@rajatgautam755421

Copy link
Copy Markdown
Contributor

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 as Hi {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_message get wp_kses_post() (preserves line breaks); everything else falls through to sanitize_text_field(), which collapses them into single spaces. The new user_registration_email_{type}_message field names don't match any existing pattern.

Fix

Adds user_registration_email_.*_message to 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.

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.

@deepench deepench left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants