Skip to:
Content
Pages
Categories
Search
Top
Bottom

Buddypress make 2 users friends


  • asokaaso2
    Participant

    @asokaaso2

    I’m trying to do an ajax function where after certain conditions are met, 2 users will become friends. I am using friends_add_friend function to achieve it but when I execute that function, my ajax function doesn’t return the success data. The friends_add_friend will execute but it will stop there preventing my ajax to display the notification. Any idea how to fix this?

    this is my code


    if($create_subscription!='fail'){
    friends_add_friend(bp_loggedin_user_id(),bp_displayed_user_id(),true); //the code stops here

    echo json_encode(array('sent'=>true, 'message'=>__('The payment was processed successfully!')));

    }

  • You must be logged in to reply to this topic.
Skip to toolbar