Can't accept friendship request if both users ask for it
-
Two users asked for friendship, so in the bp_friends table we have two records:
id initiator_user_id friend_user_id is_confirmed 1 26 5 0 2 5 26 0
Now, member 5 would like to accept friendship request from member 26, but the following code doesn’t work:
$friendship_id = BP_Friends_Friendship::get_friendship_id( $current_user_id, $id ); friends_accept_friendship( $friendship_id );
The reason lies in the function get_friendship_id, because it doesn’t return 1, but 2, which is the id of the request member 5 made to 26 and not vice versa.
Call to friends_accept_friendship with id=2 failed because the logged in user is 5 and not 26.
I think that get_friendship_id should only return the id of the matching record and not the first record that contains the pair of users.
- The topic ‘Can't accept friendship request if both users ask for it’ is closed to new replies.