-
-
Save ntwb/d45948672dbf5fd580c9 to your computer and use it in GitHub Desktop.
bbPress - Disable Mandrill for bbPress notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: bbPress - Disable Mandrill for bbPress notifications | |
Plugin URI: https://gist.github.com/ntwb/d45948672dbf5fd580c9 | |
Description: bbPress - Disable Mandrill for bbPress notifications | |
Version: 0.1 | |
Author: Stephen Edgar - Netweb | |
Author URI: http://netweb.com.au | |
*/ | |
function ntwb_mandrill_payload( $message ) { | |
// convenience variable | |
$autoTags = $message['tags']['automatic']; | |
// Is it a bbPress email? | |
if(strpos(implode(',', $autoTags),'wp_bbp_') !== false) { | |
$message['force_native'] = true; | |
} | |
// Use the default template | |
// Note: we could have specified a general template | |
// in the settings and skipped this final 'else' | |
else { | |
$message['template']['name'] = 'blog_template'; | |
} | |
return $message; | |
} | |
// Don't forget to register the filter! | |
add_filter('mandrill_payload', 'ntwb_mandrill_payload'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment