Auto Accept Friend Requests


On Buddypress, I would like friendship requests to automatically accept so the user does not have to accept the request.

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 ( 'pending' == $friendship_status ) {
// force add
friends_add_friend( $friendship_initiator_id, $friendship_friend_id, $force_accept = true );
friends_accept_friendship( $friendship_id );

// Update friend totals
friends_update_friend_totals( $friendship_initiator_id, $friendship_friend_id, 'add' );
add_action('friends_friendship_requested', 'bp_auto_accept_friend_request', 200, 3);

This works as required. However, the BP buttons still say, "Friendship Requested" even though they are already friends. Any ideas?