Disallow mention notifications/emails from user A to user B?
-
Trying to modify a block plugin for my website.
All is going well, but the “block” can be bypassed if the blocked user simply @-mentions the blocker-user. The blocker-user will then receive a notification/email from the “blocked” user.
So I’m trying to catch the notification/email prior to anything being sent. Then I’d compare user IDs and cancel it.
What function(s) should I be looking at?
I found this in bp-activity-notifcations.php but unsure if this is what I’m looking for, unless it is? Is this early enough to prevent the email too?
/** * Notify a member when their nicename is mentioned in an activity stream item. * * Hooked to the 'bp_activity_sent_mention_email' action, we piggy back off the * existing email code for now, since it does the heavy lifting for us. In the * future when we separate emails from Notifications, this will need its own * 'bp_activity_at_name_send_emails' equivalent helper function. * * @since 1.9.0 * * @param object $activity Activity object. * @param string $subject (not used) Notification subject. * @param string $message (not used) Notification message. * @param string $content (not used) Notification content. * @param int $receiver_user_id ID of user receiving notification. */ function bp_activity_at_mention_add_notification( $activity, $subject, $message, $content, $receiver_user_id ) { bp_notifications_add_notification( array( 'user_id' => $receiver_user_id, 'item_id' => $activity->id, 'secondary_item_id' => $activity->user_id, 'component_name' => buddypress()->activity->id, 'component_action' => 'new_at_mention', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } add_action( 'bp_activity_sent_mention_email', 'bp_activity_at_mention_add_notification', 10, 5 );
- The topic ‘Disallow mention notifications/emails from user A to user B?’ is closed to new replies.