AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Closed] Toggle HTML emails?

5 Posts
3 Users
1 Reactions
2,657 Views
Posts: 23
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@gunarcom)
Eminent Member
Joined: 7 years ago
[#9646]

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: 5777
 Sofy
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@sofy)
Support Team
Joined: 8 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
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@gunarcom)
Eminent Member
Joined: 7 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: 7 years ago

Trusted Member
Posts: 63
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@gunarcom

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


(@gunarcom)
Joined: 7 years ago

Eminent Member
Posts: 23
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@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. 


Share: