Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shows how to conditionally suspend auto-paragraphs with a Participants Database Email Template
add_filter( 'pdb-rich_text_filter_mode', 'suspend_rich_text_for_sms', 10, 2 );
// changes the rich text filtering mode according to content
function suspend_rich_text_for_sms( $format_setting, $content ) {
// the setting is only altered if the message is an sms message
if ( content_is_sms( $content ) ) {
$format_setting = 'none';
}
return $format_setting; // this is the setting that will be used for the current message
}
// check the content
function content_is_sms( $content ) {
/* this is an example of detecting content that should not have
/* auto-paragraphs applied
return stripos( $content, 'sms') !== false;
}
@xnau

This comment has been minimized.

Copy link
Owner Author

commented May 18, 2019

When an email is sent using the Participants Database Email Expansion Kit, the body of the email is passed through the rich text filter in Participants Database. There is a global setting for that in the plugin settings.

If you want to suspend or change that setting for a specific email, you have to do it by looking at the content for an indication that a different rule needs to be applied in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.