• Hi,

    It appears when BP sends an email, this plugin sends HTML content without the newlines replaced with paragraph tags.

    The issue appears to me to be in the plugin_actions_and_filters() method.

    My current workaround is:

    // Filter
    add_filter( 'bp_email_get_content_plaintext', [ self::class, 'autowp_templated_bp_email' ], 100, 4 );
    
    // Function
    function autowp_templated_bp_email( $value, $property_name, $transform, $email ) {
        if ( $transform !== 'replace-tokens' ) {
            return $value;
        }
    
        if ( ! str_contains( $value, '<!-- [IS BUDDYPRESS EMAIL] -->' ) ) {
            return $value;
        }
    
    
        return wpautop( $value );
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @sjregan
    Many thanks for your filter. In my side had to remove the self::class and brackets to make it accepted by Code Snippet plugin.
    It solves my issue of newlines on all Buddypress emails that were losing their format.

    Thread Starter sjregan

    (@sjregan)

    Nice one, it appears I missed that when refactoring for the example.

    So in case here is your code with my tiny modification :

    // Filter
    add_filter( 'bp_email_get_content_plaintext', 'autowp_templated_bp_email', 100, 4 );
    
    // Function
    function autowp_templated_bp_email( $value, $property_name, $transform, $email ) {
    if ( $transform !== 'replace-tokens' ) {
    return $value;
    }
    
    if ( ! str_contains( $value, '<!-- [IS BUDDYPRESS EMAIL] -->' ) ) {
        return $value;
    }
    
    return wpautop( $value );
    
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Newlines not replaced by paragraph tags’ is closed to new replies.