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/bp-core-filters.php

    r11893 r11895  
    11321132    // Make sure we add a <title> tag so WP Customizer picks it up.
    11331133    $template = str_replace( '<head>', '<head><title>' . esc_html_x( 'BuddyPress Emails', 'screen heading', 'buddypress' ) . '</title>', $template );
    1134     echo str_replace( '{{{content}}}', nl2br( get_post()->post_content ), $template );
     1134    echo str_replace( '{{{content}}}', wpautop( get_post()->post_content ), $template );
    11351135
    11361136    /*
Note: See TracChangeset for help on using the changeset viewer.