friends_notification_accepted_request( int $friendship_id, int $initiator_id, int $friend_id )
Send notifications related to the acceptance of a connection request.
Description
When a connection request is accepted, an email and a BP notification are sent to the user who requested the friendship ($initiator_id).
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.
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 ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.0.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.