Skip to:
Content
Pages
Categories
Search
Top
Bottom

request of friend


  • jennifersanchez
    Participant

    @jennifersanchez

    Hi!
    I have this code to add automatic the friend without the user accept the request.
    But it isnt working, any suggest?
    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);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar