Ticket #5289: 5289.02.diff
File 5289.02.diff, 4.6 KB (added by , 11 years ago) |
---|
-
bp-activity/bp-activity-notifications.php
351 351 add_action( 'bp_activity_screen_single_activity_permalink', 'bp_activity_remove_screen_notifications' ); 352 352 add_action( 'bp_activity_screen_mentions', 'bp_activity_remove_screen_notifications' ); 353 353 354 355 function bp_activity_at_mention_delete_notification( $activity_ids_deleted = array() ) { 356 // Let's delete all without checking if content contains any mentions 357 // to avoid a query to get the activity 358 if ( bp_is_active( 'notifications' ) && !empty( $activity_ids_deleted ) ) { 359 foreach( $activity_ids_deleted as $activity_id ) { 360 bp_notifications_delete_all_notifications_by_type( $activity_id, buddypress()->activity->id ); 361 } 362 } 363 } 364 add_action( 'bp_activity_deleted_activities', 'bp_activity_at_mention_delete_notification', 10, 1 ); -
bp-friends/bp-friends-notifications.php
293 293 bp_notifications_delete_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, buddypress()->friends->id, 'friendship_request' ); 294 294 } 295 295 } 296 add_action( 'friends_friendship_w ithdrawn', 'bp_friends_mark_friendship_withdrawn_notifications_by_item_id', 10, 2 );296 add_action( 'friends_friendship_whithdrawn', 'bp_friends_mark_friendship_withdrawn_notifications_by_item_id', 10, 2 ); 297 297 298 298 /** 299 299 * Remove friendship requests FROM user, used primarily when a user is deleted -
bp-groups/bp-groups-notifications.php
554 554 add_action( 'groups_delete_group', 'bp_groups_delete_group_delete_all_notifications', 10 ); 555 555 556 556 /** 557 * Remove promoted notifications for any demoted member 558 * 559 * @since BuddyPress (?) 560 */ 561 function bp_groups_delete_group_delete_promoted_notifications( $user_id = 0, $group_id = 0 ) { 562 if ( bp_is_active( 'notifications' ) && !empty( $group_id ) && !empty( $user_id ) ) { 563 bp_notifications_delete_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'member_promoted_to_admin' ); 564 bp_notifications_delete_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'member_promoted_to_mod' ); 565 } 566 } 567 568 add_action( 'groups_demoted_member', 'bp_groups_delete_group_delete_promoted_notifications', 10, 2 ); 569 570 /** 557 571 * Mark notifications read when a member accepts a group invitation 558 572 * 559 573 * @since BuddyPress (1.9.0) -
bp-messages/bp-messages-classes.php
127 127 $recipients = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d AND is_deleted = 0", $thread_id ) ); 128 128 129 129 if ( empty( $recipients ) ) { 130 // Get the massage id in order to delete notification 131 $message_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) ); 132 130 133 // Delete all the messages 131 134 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_messages} WHERE thread_id = %d", $thread_id ) ); 132 135 133 136 // Delete all the recipients 134 137 $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->messages->table_name_recipients} WHERE thread_id = %d", $thread_id ) ); 138 139 do_action_ref_array( 'messages_thread_deleted_thread', array( $message_id ) ); 135 140 } 136 141 137 142 return true; -
bp-messages/bp-messages-notifications.php
189 189 } 190 190 } 191 191 add_action( 'messages_screen_conversation', 'bp_messages_screen_inbox_mark_notifications', 10 ); 192 193 194 function bp_messages_message_delete_notification( $message_id = 0 ) { 195 if ( bp_is_active( 'notifications' ) && !empty( $message_id ) ) { 196 bp_notifications_delete_all_notifications_by_type( $message_id, buddypress()->messages->id ); 197 } 198 } 199 200 add_action( 'messages_thread_deleted_thread', 'bp_messages_message_delete_notification', 10, 1 ); 201