Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I force a friend request to be automatically accepted depending on user meta.

  • Hello folks.

    I’m still getting my head around buddypress, so far so good but I’ve hit a snag where I want certain users who are flagged as an ‘expert’ to automatically accept any friend requests people.

    I’ve found a couple of functions related to this but I think I’m missing something that would make this simpler such as setting a constant or overriding part of the $bp global…

    What I have so far is the following:

    `
    function bp_auto_accept_friend_request( $friendship_id, $friendship_initiator_id, $friendship_friend_id ) {
    // auto accept
    if ( is_user_expert( $friendship_friend_id ) ) {
    // force add
    friends_accept_friendship( $friendship_id );
    friends_add_friend( $friendship_initiator_id, $friendship_friend_id, true );
    }
    }
    add_action(‘friends_friendship_requested’, ‘bp_auto_accept_friend_request’, 200, 3);
    `

    Can anyone tell me where I should be looking to make this nice and seamless just as if the main settings were set to bypass the request process please?

Viewing 4 replies - 1 through 4 (of 4 total)
  • No takers on this? Sorry to bump it.

    I’ve gotten to the point where the friendship is accepted but the friendship status doesn’t seem to be updated. The notification still says “Friendship Requested” and the “Add Friend” button changes to say “Friendship Requested”. I can’t work out which step I’m missing as I still don’t really know how BuddyPress stores and works with all this stuff.


    nanchante
    Participant

    @nanchante

    ..same here. there is no “Accept Friendship” button. How to fix?


    4ella
    Participant

    @4ella

    @sanchothefat – Hi did you find a solution for that ?


    contact@peterbennett.net
    Member

    @contactpeterbennettnet

    Strange that this was discussed two years ago and still discussed now with no fix?? Please don’t say ‘you don’t need to do that’ Yes, I need to do it because IT’S WHAT THE CLIENT WANTS Any suggestions/advice to help speed up the process of doing the coding changes gratefully accepted!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can I force a friend request to be automatically accepted depending on user meta.’ is closed to new replies.
Skip to toolbar