Skip to:
Content

BuddyPress.org

Ticket #6329: 6329.diff

File 6329.diff, 969 bytes (added by pareshradadiya, 9 years ago)

messages_thread_deleted_thread hook added to force delete corresponding notifications when message is deleted and some recipients remain for message

  • src/bp-messages/classes/class-bp_messages-thread.php

     
    309309
    310310                        // Delete all the recipients
    311311                        $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $thread_id ) );
    312                 }
     312                } else {
     313            /**
     314             * Fires after a message is marked deleted. This hook is poorly named.
     315             *
     316             * @since BuddyPress (1.0.0)
     317             *
     318             * @param int $message_id ID of the message
     319             */
     320            foreach ( $message_ids as $message_id ) {
    313321
     322                do_action( 'messages_thread_deleted_thread', $message_id );
     323            }
     324        }
     325
    314326                /**
    315327                 * Fires after a message thread is either marked as deleted or deleted
    316328                 *