bp_groups_disable_at_mention_notification_for_non_public_groups( bool $send, array $usernames, int $user_id, BP_Activity_Activity $activity )

Disable at-mention notifications for users who are not a member of the non-public group where the activity appears.


Parameters Parameters

$send

(bool) (Required) Whether to send the notification.

$usernames

(array) (Required) Array of all usernames being notified.

$user_id

(int) (Required) ID of the user to be notified.

$activity

(BP_Activity_Activity) (Required) Activity object.


Top ↑

Return Return

(bool)


Source Source

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

function bp_groups_disable_at_mention_notification_for_non_public_groups( $send, $usernames, $user_id, BP_Activity_Activity $activity ) {
	// Skip the check for administrators, who can get notifications from non-public groups.
	if ( bp_user_can( $user_id, 'bp_moderate' ) ) {
		return $send;
	}

	if ( 'groups' === $activity->component && ! bp_user_can( $user_id, 'groups_access_group', array( 'group_id' => $activity->item_id ) ) ) {
		$send = false;
	}

	return $send;
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.