Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick an easy way to remove author and current user from the notification recipients. Works in Edit Flow 0.4+
<?php
function filter_recipients($recipients, $post) {
// grab the users we want to filter
$author = get_userdata($post->post_author);
$current_user = wp_get_current_user();
// Remove author and user who made the change from notification
$recipients = array_values( array_diff( $recipients,array($author->user_email, $current_user->user_email) ) ); // sorta hacky way to remove the element, found here: http://www.bin-co.com/php/scripts/array_remove.php
return $recipients;
}
add_filter('ef_notfication_recipients', 'filter_recipients', 10, 2);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment