Skip to content

Instantly share code, notes, and snippets.

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 boonebgorges/8669147e3e0ce743d03d65638a7a6866 to your computer and use it in GitHub Desktop.
Save boonebgorges/8669147e3e0ce743d03d65638a7a6866 to your computer and use it in GitHub Desktop.
Prevent BP message replies from triggering notifications
<?php
remove_action( 'messages_message_sent', 'messages_notification_new_message', 10 );
add_action(
'messages_message_sent',
function( $message ) {
$thread_messages = BP_Messages_Thread::get_messages( $message->thread_id );
if ( 1 === count( $thread_messages ) && $message->id === $thread_messages[0]->id ) {
messages_notification_new_message( $message );
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment