bp_activity_remove_screen_notifications_for_non_mentions()

Mark non-mention notifications as read when user visits our read permalink.

Description

In particular, ‘update_reply’ and ‘comment_reply’ notifications are handled here. See bp_activity_format_notifications() for more info.

Source

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

function bp_activity_remove_screen_notifications_for_non_mentions() {
	if ( false === is_singular() || false === is_user_logged_in() || empty( $_GET['nid'] ) ) {
		return;
	}

	// Mark notification as read.
	BP_Notifications_Notification::update(
		array(
			'is_new'  => false
		),
		array(
			'user_id' => bp_loggedin_user_id(),
			'id'      => (int) $_GET['nid']
		)
	);
}

Changelog

Changelog
Version Description
BuddyPress 2.6.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.