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?