Skip to:
Content

BuddyPress.org

Ticket #7706: 0001-use-wpautop-instead-of-nl2br-in-email-content.patch

File 0001-use-wpautop-instead-of-nl2br-in-email-content.patch, 1.7 KB (added by chherbst, 20 months ago)
  • bp-core/bp-core-filters.php

    From dd6fe5b61e5fa2180051e7748514ff968cbc9f10 Mon Sep 17 00:00:00 2001
    From: Christoph Herbst <chris.p.herbst@gmail.com>
    Date: Wed, 28 Feb 2018 13:26:21 +0100
    Subject: [PATCH] use wpautop instead of nl2br in email content
    
    ---
     bp-core/bp-core-filters.php        | 2 +-
     bp-core/classes/class-bp-email.php | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/bp-core/bp-core-filters.php b/bp-core/bp-core-filters.php
    index 8d3be6e..fb43c32 100644
    a b function bp_core_render_email_template( $template ) { 
    11321132
    11331133        // Make sure we add a <title> tag so WP Customizer picks it up.
    11341134        $template = str_replace( '<head>', '<head><title>' . esc_html_x( 'BuddyPress Emails', 'screen heading', 'buddypress' ) . '</title>', $template );
    1135         echo str_replace( '{{{content}}}', nl2br( get_post()->post_content ), $template );
     1135        echo str_replace( '{{{content}}}', wpautop( get_post()->post_content ), $template );
    11361136
    11371137        /*
    11381138         * Link colours are applied directly in the email template before sending, so we
  • bp-core/classes/class-bp-email.php

    diff --git a/bp-core/classes/class-bp-email.php b/bp-core/classes/class-bp-email.php
    index f4de900..19c22c6 100644
    a b class BP_Email { 
    246246                switch ( $transform ) {
    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
    252252                        case 'replace-tokens':