Changeset 9744 for trunk/src/bp-messages/bp-messages-notifications.php
- Timestamp:
- 04/12/2015 07:42:38 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-notifications.php
r9351 r9744 298 298 * @since BuddyPress (2.0.0) 299 299 * 300 * @param int $message_id ID of the message. 301 */ 302 function bp_messages_message_delete_notifications( $message_id = 0 ) { 303 if ( bp_is_active( 'notifications' ) && ! empty( $message_id ) ) { 304 bp_notifications_delete_notifications_by_item_id( bp_loggedin_user_id(), (int) $message_id, buddypress()->messages->id, 'new_message' ); 305 } 306 } 307 add_action( 'messages_thread_deleted_thread', 'bp_messages_message_delete_notifications', 10, 1 ); 300 * @param int $message_id ID of the thread. 301 * @param array $message_ids IDs of the messages. 302 */ 303 function bp_messages_message_delete_notifications( $thread_id, $message_ids ) { 304 if ( ! bp_is_active( 'notifications' ) ) { 305 return; 306 } 307 308 // For each recipient, delete notifications corresponding to each message. 309 $thread = new BP_Messages_Thread( $thread_id ); 310 foreach ( $thread->get_recipients() as $recipient ) { 311 foreach ( $message_ids as $message_id ) { 312 bp_notifications_delete_notifications_by_item_id( $recipient->user_id, (int) $message_id, buddypress()->messages->id, 'new_message' ); 313 } 314 } 315 } 316 add_action( 'bp_messages_thread_after_delete', 'bp_messages_message_delete_notifications', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.