diff --git src/bp-notifications/bp-notifications-functions.php src/bp-notifications/bp-notifications-functions.php
index 9ff2a8d..1b6ff27 100644
|
|
function bp_notifications_delete_notifications_from_user( $user_id, $component_n |
420 | 420 | ) ); |
421 | 421 | } |
422 | 422 | |
| 423 | /** |
| 424 | * Delete a user's notifications when the user is deleted. |
| 425 | * |
| 426 | * @since 2.4.0 |
| 427 | * |
| 428 | * @param int $user_id ID of the user who is about to be deleted. |
| 429 | * |
| 430 | * @return int|bool The number of rows updated or false on error. |
| 431 | */ |
| 432 | function bp_notifications_delete_notifications_on_user_delete( $user_id ) { |
| 433 | |
| 434 | return BP_Notifications_Notification::delete( array( |
| 435 | 'user_id' => $user_id, |
| 436 | 'item_id' => false, |
| 437 | 'secondary_item_id' => false, |
| 438 | 'component_action' => false, |
| 439 | 'component_name' => false |
| 440 | ) ); |
| 441 | } |
| 442 | add_action( 'wpmu_delete_user', 'bp_notifications_delete_notifications_on_user_delete' ); |
| 443 | add_action( 'delete_user', 'bp_notifications_delete_notifications_on_user_delete' ); |
| 444 | |
423 | 445 | /** Mark **********************************************************************/ |
424 | 446 | |
425 | 447 | /** |