[buddypress-trac] [BuddyPress Trac] #9305: 'joined_group' activity item not removed when user leaves group or is removed from the group

buddypress-trac noreply at wordpress.org
Thu Sep 18 04:22:32 UTC 2025


#9305: 'joined_group' activity item not removed when user leaves group or is
removed from the group
--------------------------+-----------------------------
 Reporter:  r-a-y         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Groups        |    Version:  1.9
 Severity:  minor         |   Keywords:  dev-feedback
--------------------------+-----------------------------
 There are a few issues when a user leaves a group and with their
 corresponding `'joined_group'` activity item:

 === 1. When you join a group and leave the group, the 'joined_group'
 activity item is not removed

 This was last touched in
 https://github.com/buddypress/buddypress/commit/8db16ebbcc4eb7cbf955d415635e4c6a00ebc1e1
 #diff-5e3670bc398e40e7b.

 The issue is grabbing the group membership object ''after'' the user has
 been removed from the group:
 https://github.com/buddypress/buddypress/blob/8c0406454b260566fb17fc6cb21d755838eac675/src
 /bp-groups/bp-groups-activity.php#L903-L916,
 https://github.com/buddypress/buddypress/blob/8c0406454b260566fb17fc6cb21d755838eac675/src
 /bp-groups/bp-groups-functions.php#L638-L648.

 This means that the `'date_modified'` property doesn't exist, which leads
 to the membership check failing and the activity deletion not occurring.


 === 2. There is a five-minute conditional check to determine whether the
 'joined_group' activity item should be removed or not

 If a user has been a member of a group longer than five minutes and if
 that user is removed (whether by manually leaving or removed/banned by a
 group admin), the corresponding `'joined_group'` activity entry will not
 be deleted.

 Before I work up a patch, I generally think that this 5-minute membership
 check is unnecessary. It was introduced way back in
 https://github.com/buddypress/buddypress/commit/bbad97385015a171c8c52cb788ced2c1705221fd
 #diff-6bc6696e8c90e746617fe12d44d16641280cccb4d292c2ed278c74dfaaaff345, so
 this is quite old, but I'd like to consider removing this membership time
 check.

 According to the commit message, the time check was meant to be some form
 of activity flood protection, but wouldn't this type of functionality be
 best suited in a plugin? Thoughts?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9305>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list