friends_notification_accepted_request( int $friendship_id, int $initiator_id, int $friend_id )

Send notifications related to the acceptance of a friendship request.


Description Description

When a friendship request is accepted, an email and a BP notification are sent to the user who requested the friendship ($initiator_id).


Parameters Parameters

$friendship_id

(Required) ID of the friendship object.

$initiator_id

(Required) ID of the user who initiated the request.

$friend_id

(Required) ID of the request recipient.


Top ↑

Source Source

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

function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
	if ( 'no' == bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) ) {
		return;
	}

	$unsubscribe_args = array(
		'user_id'           => $initiator_id,
		'notification_type' => 'friends-request-accepted',
	);

	$args = array(
		'tokens' => array(
			'friend.id'      => $friend_id,
			'friendship.url' => esc_url( bp_core_get_user_domain( $friend_id ) ),
			'friend.name'    => bp_core_get_user_displayname( $friend_id ),
			'friendship.id'  => $friendship_id,
			'initiator.id'   => $initiator_id,
			'unsubscribe'	   => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
		),
	);
	bp_send_email( 'friends-request-accepted', $initiator_id, $args );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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