Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/09/2014 07:46:01 PM (11 years ago)
Author:
boonebgorges
Message:

When a message is deleted, delete corresponding notifications

Fixes #5289

Props imath, henrywright

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-classes.php

    r8053 r8099  
    213213        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_deleted = 1 WHERE thread_id = %d AND user_id = %d", $thread_id, bp_loggedin_user_id() ) );
    214214
     215        // Get the message id in order to pass to the action
     216        $message_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) );
     217
    215218        // Check to see if any more recipients remain for this message
    216219        // if not, then delete the message from the database.
     
    224227            $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $thread_id ) );
    225228        }
     229
     230        do_action( 'messages_thread_deleted_thread', $message_id );
    226231
    227232        return true;
Note: See TracChangeset for help on using the changeset viewer.