bp_groups_screen_my_groups_mark_notifications()

Mark notifications read when a member views their group memberships.

Description

Source

File: bp-groups/bp-groups-notifications.php

1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
function bp_groups_screen_my_groups_mark_notifications() {
 
    // Delete group request notifications for the user.
    if ( isset( $_GET['n'] ) && bp_is_active( 'notifications' ) ) {
 
        // Get the necessary ID's.
        $group_id = buddypress()->groups->id;
        $user_id  = bp_loggedin_user_id();
 
        // Mark notifications read.
        bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'membership_request_accepted' );
        bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'membership_request_rejected' );
        bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'member_promoted_to_mod'      );
        bp_notifications_mark_notifications_by_type( $user_id, $group_id, 'member_promoted_to_admin'    );
    }
}

Changelog

Changelog
Version Description
BuddyPress 1.9.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.