Changeset 12438
- Timestamp:
- 08/12/2019 08:45:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/actions/leave-group.php
r11923 r12438 60 60 } 61 61 add_action( 'bp_actions', 'groups_action_leave_group' ); 62 63 /** 64 * Clean up requests/invites when a member leaves a group. 65 * 66 * @since 5.0.0 67 */ 68 function groups_action_clean_up_invites_requests( $user_id, $group_id ) { 69 70 $invites_class = new BP_Groups_Invitation_Manager(); 71 // Remove invitations/requests where the deleted user is the receiver. 72 $invites_class->delete( array( 73 'user_id' => $user_id, 74 'item_id' => $group_id, 75 'type' => 'all' 76 ) ); 77 /** 78 * Remove invitations where the deleted user is the sender. 79 * We'll use groups_uninvite_user() so that notifications will be cleaned up. 80 */ 81 $pending_invites = groups_get_invites( array( 82 'inviter_id' => $user_id, 83 'item_id' => $group_id, 84 ) ); 85 86 if ( $pending_invites ) { 87 foreach ( $pending_invites as $invite ) { 88 groups_uninvite_user( $invite->user_id, $group_id, $user_id ); 89 } 90 } 91 } 92 add_action( 'bp_groups_member_after_delete', 'groups_action_clean_up_invites_requests', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.