bp_friends_format_activity_action_friendship_accepted( string $action, object $activity )

Format ‘friendship_accepted’ activity actions.

Description

Parameters

$action

(Required) Activity action string.

$activity

(Required) Activity data.

Return

(string) $action Formatted activity action.

Source

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

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
function bp_friends_format_activity_action_friendship_accepted( $action, $activity ) {
    $initiator_link = bp_core_get_userlink( $activity->user_id );
    $friend_link    = bp_core_get_userlink( $activity->secondary_item_id );
 
    $action = sprintf( __( '%1$s and %2$s are now connected', 'buddyboss' ), $initiator_link, $friend_link );
 
    // Backward compatibility for legacy filter
    // The old filter has the $friendship object passed to it. We want to
    // avoid having to build this object if it's not necessary.
    if ( has_filter( 'friends_activity_friendship_accepted_action' ) ) {
        $friendship = new BP_Friends_Friendship( $activity->item_id );
        $action     = apply_filters( 'friends_activity_friendsip_accepted_action', $action, $friendship );
    }
 
    /**
     * Filters the 'friendship_accepted' activity action format.
     *
     * @since BuddyPress 2.0.0
     *
     * @param string $action   String text for the 'friendship_accepted' action.
     * @param object $activity Activity data.
     */
    return apply_filters( 'bp_friends_format_activity_action_friendship_accepted', $action, $activity );
}

Changelog

Changelog
Version Description
BuddyPress 2.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.