Notifications
Clear all

wpForo 1.x.x [Closed] Toggle HTML emails?

5 Posts
3 Users
1 Likes
1,441 Views
Posts: 23
Topic starter
(@gunarcom)
Eminent Member
Joined: 5 years ago

Is there any way to toggle html emails? I don't need registration or other core emails, just post notifications, so I'm not too concerned about filters.

I just want to make the forum emails match my other official emails.

I found the code below in a previous post but it crashed my site, Is there any other way to allow HTML in emails?

function my_custom_email_html_tags( $allowed_html ){
if( $allowed_post_html = wp_kses_allowed_html( 'post' ) ){
$allowed_html = $allowed_post_html
}
return $allowed_html;
}
add_filter( 'wpforo_kses_allowed_html_email', 'my_custom_email_html_tags');
4 Replies
Sofy
Posts: 4237
 Sofy
Admin
(@sofy)
Support Team
Joined: 6 years ago

Hi @gunarcom,

I don't follow you well. Currently, wpForo allows sending HTML emails. 

If there are some tags that are not allowed you should use the following hook:

add_filter('wpforo_kses_allowed_html_email', 'custom_wpforo_kses_allowed_html_email');
function custom_wpforo_kses_allowed_html_email($allowed_html){
if( !wpfkey($allowed_html, 'h1') ) $allowed_html['h1'] = array();
if( !wpfkey($allowed_html['h1'], 'style') ) $allowed_html['h1']['style'] = array();
if( !wpfkey($allowed_html, 'span') ) $allowed_html['span'] = array();
if( !wpfkey($allowed_html['span'], 'style') ) $allowed_html['span']['style'] = array();
return $allowed_html;
}

 

Posts: 23
Topic starter
(@gunarcom)
Eminent Member
Joined: 5 years ago

Thanks, I guess it was just stripping out most of the email like tables, images, and divs.

I will try adding the tags into your filter. Thanks.

2 Replies
(@hshah)
Joined: 5 years ago

Trusted Member
Posts: 63

@gunarcom

Did you get this working by any chance?  I'm trying to do the same thing and am struggling 🙁

(@gunarcom)
Joined: 5 years ago

Eminent Member
Posts: 23

@hshah

I haven't. I put this task on the back burner since I don't honestly know how long it will take or even work. I will probably get around to it in the next week or so and I will post my results here.

I will probably end up simplifying my email templates for the forum just to get the task done.