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.


Parameters Parameters

$friendship_id

(int) (Required) The unique ID of the friendship.

$initiator_user_id

(int) (Required) The friendship initiator user ID.

$friend_user_id

(int) (Required) The friendship request receiver user ID.


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.