Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/07/2018 12:27:57 PM (7 years ago)
Author:
djpaul
Message:

Emails: use wpautop() instead of nl2br() when rendering HTML email content.

When including markup in the email body, e.g. tables, these are usually saved by
the WordPress editor with newlines after each tag. These newlines get converted
by nl2br() to <br> tags. As <br> tags are not allowed between all elements,
e.g. <tr> and <td>, these get pulled in front of the table by most browsers
and email clients.

This leads to a lot of <br> tags in front of the table -- undesired whitespace.

Fixes #7706

Props chherbst

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-email.php

    r10696 r11895  
    247247            // Special-case to fill the $template with the email $content.
    248248            case 'add-content':
    249                 $retval = str_replace( '{{{content}}}', nl2br( $this->get_content( 'replace-tokens' ) ), $retval );
     249                $retval = str_replace( '{{{content}}}', wpautop( $this->get_content( 'replace-tokens' ) ), $retval );
    250250                // Fall through.
    251251
Note: See TracChangeset for help on using the changeset viewer.