Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/08/2016 02:11:17 AM (3 years ago)
Author:
boonebgorges
Message:

When a group membership request is approved or rejected, mark all related notifications as read.

Fixes #7375.

File:
1 edited

Legend:

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

    r11091 r11278  
    968968
    969969/**
     970 * Mark notifications read when a member's group membership request is granted.
     971 *
     972 * @since 2.8.0
     973 *
     974 * @param int $user_id  ID of the user.
     975 * @param int $group_id ID of the group.
     976 */
     977function bp_groups_accept_request_mark_notifications( $user_id, $group_id ) {
     978    if ( bp_is_active( 'notifications' ) ) {
     979        // First null parameter marks read for all admins.
     980        bp_notifications_mark_notifications_by_item_id( null, $group_id, buddypress()->groups->id, 'new_membership_request', $user_id );
     981    }
     982}
     983add_action( 'groups_membership_accepted', 'bp_groups_accept_request_mark_notifications', 10, 2 );
     984add_action( 'groups_membership_rejected', 'bp_groups_accept_request_mark_notifications', 10, 2 );
     985
     986/**
    970987 * Mark notifications read when a member views their group memberships.
    971988 *
Note: See TracChangeset for help on using the changeset viewer.