Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/12/2019 08:45:04 PM (14 months ago)
Author:
dcavins
Message:

Invitations: Clean up notifications on acceptance.

Clean up stray notifications when an invitation is revoked.

Props imath.

See #6210.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-notifications.php

    r12429 r12437  
    962962}
    963963add_action( 'groups_delete_group', 'bp_groups_delete_group_delete_all_notifications', 10 );
     964
     965/**
     966 * Remove Group invite notification when a user is uninvited.
     967 *
     968 * @since 5.0.0
     969 *
     970 * @param int $group_id ID of the group being uninvited from.
     971 * @param int $user_id  ID of the user being uninvited.
     972 */
     973function bp_groups_uninvite_user_delete_group_invite_notification( $group_id = 0, $user_id = 0 ) {
     974    if ( ! bp_is_active( 'notifications' ) || ! $group_id || ! $user_id ) {
     975        return;
     976    }
     977
     978    bp_notifications_delete_notifications_by_item_id( $user_id, $group_id, buddypress()->groups->id, 'group_invite' );
     979}
     980add_action( 'groups_uninvite_user', 'bp_groups_uninvite_user_delete_group_invite_notification', 10, 2 );
    964981
    965982/**
Note: See TracChangeset for help on using the changeset viewer.