Skip to content

Instantly share code, notes, and snippets.

@ntwb
Created June 19, 2014 10:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntwb/d45948672dbf5fd580c9 to your computer and use it in GitHub Desktop.
Save ntwb/d45948672dbf5fd580c9 to your computer and use it in GitHub Desktop.
bbPress - Disable Mandrill for bbPress notifications
<?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