bp_activity_at_mention_add_notification( object $activity, string $subject, string $message, string $content, int $receiver_user_id )

Notify a member when their nicename is mentioned in an activity feed item.

Description

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.

Parameters

$activity

(Required) Activity object.

$subject

(Required) (not used) Notification subject.

$message

(Required) (not used) Notification message.

$content

(Required) (not used) Notification content.

$receiver_user_id

(Required) ID of user receiving notification.

Source

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

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,
	) );
}

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.