Tagged: BuddyPress Auto Friendship Pro, Conditions
Hi Dianne,
Thank you for upgrading your memmbership. i sincerely appreciate it.we do not automatically renew any subscription. so, there won’t be any new charge in future unless you renew manually.
Here is the code to auto add friendship with group admins(organizers in case of BuddyBoss)
/** * Creates friendship with group admin. * * @param int $group_id group id. * @param int $user_id user id joining group. */ function bdcustom_create_group_friendships( $group_id, $user_id ) { $admin_ids = groups_get_group_admins( $group_id ); //$mod_user_ids = groups_get_group_mods( $group_id ); // uncomment if you want to enable for mods too. $group_member_ids = $admin_ids; // array_unique( array_merge( $admin_ids, $mod_user_ids ) ); foreach ( $group_member_ids as $group_member_id ) { if ( $user_id == $group_member_id || friends_check_friendship( $user_id, $group_member_id ) ) { continue; } friends_add_friend( $user_id, $group_member_id, true ); } } add_action( 'groups_join_group', function ( $group_id, $user_id ) { bdcustom_create_group_friendships( $group_id, $user_id ); } );
Please do note that a similar but more refined approach(option for group admin, mods, all members friendship ) will be available in Auto Friendship pro in next release.
Regards
BrajeshHello Brajesh,
I looked at the ADD NEW LIST (Friendship list under USERS). I don’t see anything there to select and I tried having a Member join a group where the Member and the Group Organizer were NOT YET connected. The snippet code is active. However, the friendship is not being made with the Group Organizers.
I’m wondering if I am missing a step to make this work. It might just be best to wait until the plugin is released. But I would like to test this to see how it works.
I’m also thinking it would be nice if Group Admins could decide which of their own Groups they want to have automatic friendships and those they do not. For example: They may want to make auto friends in a PRIVATE Group where they can control who is allowed to join, versus a PUBLIC Group where anybody on the site can join the Group.
Another sophistication that you might consider is: IF a Group Member leaves the Group, the Group Admin is notified and can determine if they want to remain friends with the Member who left.
Thanks, Dianne
Hi Dianne,
Thank you for the reply.The code is independent of the plugin. You will not find anything related to group in the current BuddyPress Auto Friendship pro.
Please add the code to your bp-custom.php and then try joining some public group and see if the users are added as friends or not?
PS:- Notification for user leaving the group is beyond the scope of this plugin. It might be a good idea for some other tool though.
Regards
BrajeshHello Brajesh,
Where is the bp-custom.php file located? I tried looking under the WP-Admin, WP-Content, and WP-Includes. I can’t find bp-custom.php. I googled where to find it, but it doesn’t exist in the wp-content/plugins folder.
Thank you for your assistance.
Dianne- This reply was modified 2 years, 2 months ago by Known-Admin.
Hello Brajesh,
I just figured out that I needed to create the bp-custom.php file. You do not need to respond.
Thank you, Dianne
Hello Brajesh,
Sorry to bother you once again. Here are the results of creating the new bp-custom.php file and placing it in the site’s wp-content/plugins folder:
* The JOIN button does not change text to Member until I refresh the screen.
* The Member IS ADDED to the group
* The Member is NOT added as a friend of any of the Group AdminsI better just wait until the updated plugin is released.
Blessings, Dianne
Hi Dianne,
I am sorry, It seems that something is causing error.Please allow me to get back to you in 24 hours after testing the code again.
Regards
BrajeshJust checking back with you for a possible solution.
Waiting for the release of the newest Auto Friendship Pro version. – Dianne
- This reply was modified 2 years, 1 month ago by Known-Admin.
Hi Dianne,
Thank you for the patience. I am sorry, i haven’t been able to release the update.Please allow me couple more days and I will release the updates.
Regards
BrajeshHello Brajesh,
No problem! I’m sure you are testing and making sure it is perfect for all of us. I appreciate that you are taking the extra time to do that.
Dianne
You must be logged in to reply to this topic.