bp_friends_add_friendship_accepted_notification( int $friendship_id, int $initiator_user_id, int $friend_user_id )

Notify a member when another member accepts their virtual friendship request.


Description Description


Parameters Parameters

$friendship_id

(Required) The unique ID of the friendship.

$initiator_user_id

(Required) The friendship initiator user ID.

$friend_user_id

(Required) The friendship request receiver user ID.


Top ↑

Source Source

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

function bp_friends_add_friendship_accepted_notification( $friendship_id, $initiator_user_id, $friend_user_id ) {
	// Remove the friend request notice.
	bp_notifications_mark_notifications_by_item_id( $friend_user_id, $initiator_user_id, buddypress()->friends->id, 'friendship_request' );

	// Add a friend accepted notice for the initiating user.
	bp_notifications_add_notification(  array(
		'user_id'           => $initiator_user_id,
		'item_id'           => $friend_user_id,
		'secondary_item_id' => $friendship_id,
		'component_name'    => buddypress()->friends->id,
		'component_action'  => 'friendship_accepted',
		'date_notified'     => bp_core_current_time(),
		'is_new'            => 1,
	) );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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