Skip to content

Instantly share code, notes, and snippets.

@xnau
Last active July 29, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xnau/a99a2461a144998306b6dfe59a7cfe01 to your computer and use it in GitHub Desktop.
Save xnau/a99a2461a144998306b6dfe59a7cfe01 to your computer and use it in GitHub Desktop.
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
Copy link
Author

xnau 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