friends_reject_friendship( int $friendship_id )

Mark a connection request as rejected.

Description

Parameters

$friendship_id

(Required) ID of the pending friendship object.

Return

(bool) True on success, false on failure.

Source

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

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
function friends_reject_friendship( $friendship_id ) {
    $friendship = new BP_Friends_Friendship( $friendship_id, true, false );
 
    if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::reject( $friendship_id ) ) {
 
        /**
         * Fires after a connection request is rejected.
         *
         * @since BuddyPress 1.0.0
         *
         * @param int                   $friendship_id ID of the pending friendship.
         * @param BP_Friends_Friendship $friendships Friendship object. Passed by reference.
         */
        do_action_ref_array( 'friends_friendship_rejected', array( $friendship_id, &$friendship ) );
        return true;
    }
 
    return false;
}

Changelog

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.