BuddyDev

Search

Add to a friend without the request.(when i push the buttom add to friend)

  • Participant
    Level: Enlightened
    Posts: 53
    Jennifer on #23235

    Hi!
    I have test this code to add automatic the friend without the user accept the request.But it isnt working, any suggest?
    I searched by source and could not find it. I tried with follow plugin but it isnt the same ..

    Thanks very much!

    function bp_auto_accept_friend_request( $friendship_id, $friendship_initiator_id, $friendship_friend_id ) {
            $friendship_status = BP_Friends_Friendship::check_is_friend( $friendship_initiator_id, $friendship_friend_id );
            if ( 'not_friends' == $friendship_status )  {
                // force add
                friends_add_friend( $friendship_initiator_id, $friendship_friend_id, true );
                friends_accept_friendship( $friendship_id );
            
            }
        }
        add_action('friends_friendship_requested', 'bp_auto_accept_friend_request', 200, 3);

You must be logged in to reply to this topic.

This topic is: not resolved