Notifications
Clear all

wpForo 1.x.x [Closed] Change the content type of emails

4 Posts
2 Users
0 Reactions
2,568 Views
arcticsolutions
Posts: 22
Topic starter
(@arcticsolutions)
Eminent Member
Joined: 6 years ago

Hello..

I am using WP Better Emails to add html templates to my emails and got a problem with your plugins emails as they are set to text/html using the filter add_filter( 'wp_mail_content_type', 'wpforo_set_html_content_type' );

WB better emails require content type text/plain before it wrap the html template to the email.

I can not use the same filter as i then get conflict with other plugins i am using unless you have / know any condition i can set in my filter function to check that the email actually is from wpForo or other of your addons.

Something like this:

add_filter( 'wp_mail_content_type', 'aws_wpforo_set_html_content_type', 11 );

function aws_wpforo_set_html_content_type() {
       if ( wpForo ) {
	return 'text/plain';
       } 
} 

Thanks
Rune

3 Replies
1 Reply
arcticsolutions
(@arcticsolutions)
Joined: 6 years ago

Eminent Member
Posts: 22

I did find your function in wpf-hooks.php line 915, so if you could change that function to something as below it would be easy to hook into it with our own content type.

function wpforo_set_html_content_type(){
	$content_type = apply_filters('wpforo_emails_content_type', 'text/html');
	return $content_type;
} 

Thanks
Rune

Robert
Posts: 10589
Admin
(@robert)
Support Team
Joined: 9 years ago

Ok, it's done. You can use this hook in next version.

arcticsolutions
Posts: 22
Topic starter
(@arcticsolutions)
Eminent Member
Joined: 6 years ago

Thanks a lot 🙂

Rune