bp_get_friend_accept_request_link()

Return the URL for accepting the current friendship request in the loop.

Description

Return

(string) accept-friendship URL.

Source

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

645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
function bp_get_friend_accept_request_link() {
    global $members_template;
 
    if ( !$friendship_id = wp_cache_get( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id() ) ) {
        $friendship_id = friends_get_friendship_id( $members_template->member->id, bp_loggedin_user_id() );
        wp_cache_set( 'friendship_id_' . $members_template->member->id . '_' . bp_loggedin_user_id(), $friendship_id, 'bp' );
    }
 
    /**
     * Filters the URL for accepting the current friendship request in the loop.
     *
     * @since BuddyPress 1.0.0
     * @since BuddyPress 2.6.0 Added the `$friendship_id` parameter.
     *
     * @param string $value         Accept-friendship URL.
     * @param int    $friendship_id ID of the friendship.
     */
    return apply_filters( 'bp_get_friend_accept_request_link', wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/accept/' . $friendship_id ), 'friends_accept_friendship' ), $friendship_id );
}

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.