From 1659e4070c538416333c278e3eb3b3b3a6090548 Mon Sep 17 00:00:00 2001 From: r-a-y Date: Thu, 29 Oct 2015 14:57:59 -0700 Subject: [PATCH] Follow: Delete follow relationship when new paper activity item is deleted. See #7. --- includes/hooks-buddypress-follow.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/hooks-buddypress-follow.php b/includes/hooks-buddypress-follow.php index fa5c982..0e9f3a7 100644 --- a/includes/hooks-buddypress-follow.php +++ b/includes/hooks-buddypress-follow.php @@ -655,6 +655,14 @@ function cacsp_follow_clear_cache_on_activity_delete( $activities ) { // delete queried papers that user was following wp_cache_delete( $activity->follower_id, 'bp_follow_user_cacsp_paper_following_query' ); + + // Delete the follow entry + // @todo Need a mass bulk-delete method + bp_follow_stop_following( array( + 'leader_id' => $activity->leader_id, + 'follower_id' => $activity->follower_id, + 'follow_type' => 'cacsp_paper' + ) ); } }