Skip to content

Instantly share code, notes, and snippets.

@dwenaus
Created February 2, 2014 03:47
Show Gist options
  • Save dwenaus/8762785 to your computer and use it in GitHub Desktop.
Save dwenaus/8762785 to your computer and use it in GitHub Desktop.
code to add to functions.php so that BuddyPress Group Email Subscription plugin plays nicely with WP Better Emails plugin
// if the WP_Better_Emails plugin is installed, stop BuddyPress Group Email Subscription plugin from wrapping digests with <html><body>$message</body></html>
function my_dont_wrap_digests_with_html_twice( $message, $message_pre_html_wrap ) {
if ( class_exists( 'WP_Better_Emails' ) ) {
$message = $message_pre_html_wrap;
}
return $message;
}
add_filter( 'ass_digest_message_html', 'my_dont_wrap_digests_with_html_twice', 10, 2 );
@pierre-dickinson
Copy link

i've really tried to disabled the html formating for digest mail but it didn't work, even if i comment this line:
$message = apply_filters( 'ass_digest_message_html', "{$message}", $message );
i still get the html formating which doesn't work with the WP_Better_Email plugin... please help!

@pierre-dickinson
Copy link

hmmm i've placed the code in my bp-custom.php but it doesn't change anything. Thanks Dwenaus but i'll have to try something else!
Here's a wordpress forum topic about it on the WP Better Emails Plugin support : https://wordpress.org/support/topic/also-customize-the-emails-of-buddypress

@pierre-dickinson
Copy link

Hi, i have found a sort of work out to disable html formating for Wp Better Email Digest, please help me to write the function !
boonebgorges/buddypress-group-email-subscription#65

@pierre-dickinson
Copy link

Is this function correct? (i've placed it in my bp-custom.php file)

function my_digests_in_plain_text( $headers ) {
    if ( class_exists( 'WP_Better_Emails' ) ) {
        $headers = array( 'Content-type: text/plain' );
    }
    return $headers;
}
add_filter( 'ass_send_multipart_email', 'my_digests_in_plain_text', 10, 2 );

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