BuddyDev

Search

[Resolved] Auto accept all buddypress friendship requests

  • Participant
    Level: Master
    Posts: 285
    evillizard on #44571

    Pls How do i make ALL friendship requests to always be immediately automatically accepted ? – i don’t want users to have to accept friend requests , i would prefer it to be automatically acccepted immediately it’s sent

  • Participant
    Level: Master
    Posts: 285
    evillizard on #44593

    Bump

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #44611

    Hi Iken,
    Please avoid bumping quickly. This is a free support question and depends on availability of free time.

    Here is a solution for your issue

    
    // auto accept friendship.
    add_action( 'friends_friendship_requested', function ( $friendship_id, $initiator_id, $user_id, $friendship ) {
    	$friendship->is_confirmed = 1;
    	$friendship->save();
    }, 10, 4 );
    
    

    This will auto accept the request but the way template packs have been created, The user will see they have been automatically added in next page reload.

    You should also modify the friendship request notification mail to say something more relevant for this use case.

    Regards
    Brajesh

  • Participant
    Level: Master
    Posts: 285
    evillizard on #44647

    Thank you

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #44690

    You are welcome.

The topic ‘ [Resolved] Auto accept all buddypress friendship requests’ is closed to new replies.

This topic is: resolved