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.
Description
Parameters
- $send
-
(Required) Whether to send the notification.
- $usernames
-
(Required) Array of all usernames being notified.
- $user_id
-
(Required) ID of the user to be notified.
- $activity
-
(Required) Activity object.
Return
(bool)
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;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.5.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.