Changeset 8099
- Timestamp:
- 03/09/2014 07:46:01 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-classes.php
r8053 r8099 213 213 $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() ) ); 214 214 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 215 218 // Check to see if any more recipients remain for this message 216 219 // if not, then delete the message from the database. … … 224 227 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $thread_id ) ); 225 228 } 229 230 do_action( 'messages_thread_deleted_thread', $message_id ); 226 231 227 232 return true; -
trunk/bp-messages/bp-messages-notifications.php
r7650 r8099 190 190 } 191 191 add_action( 'messages_screen_conversation', 'bp_messages_screen_inbox_mark_notifications', 10 ); 192 193 /** 194 * When a message is deleted, delete corresponding notifications. 195 * 196 * @since BuddyPress (2.0.0) 197 * 198 * @param int $message_id ID of the message. 199 */ 200 function bp_messages_message_delete_notifications( $message_id = 0 ) { 201 if ( bp_is_active( 'notifications' ) && ! empty( $message_id ) ) { 202 bp_notifications_delete_notifications_by_item_id( bp_loggedin_user_id(), (int) $message_id, buddypress()->messages->id, 'new_message' ); 203 } 204 } 205 add_action( 'messages_thread_deleted_thread', 'bp_messages_message_delete_notifications', 10, 1 );
Note: See TracChangeset
for help on using the changeset viewer.