Forums
-
- Forum
- Posts
-
- Installing BuddyPress
- 23,840
- How-to & Troubleshooting
- 129,871
- Creating & Extending
- 25,902
- Requests & Feedback
- 9,548
- Third Party Plugins
- 9,832
- Showcase
- 3,316
- Ideas
- 1,402
- Miscellaneous
- 9,178
-
Hi @ankitjoshi11 – Check out the file buddypress/bp-friends/bp-friends-functions.php. The functions you’ll need are:
friends_add_friend( $initiator_userid, $friend_userid );
which accepts a third $force_accept parameter which makes it unnecessary for user B to manually accept. If you want to handle acceptance separately, look at
friends_accept_friendship( $friendship_id );
You can get the $friendship_id for two users with friends_get_friendship_id( $user_a, $user_b );
Good luck with your project!