Shape the future of Social networking with WordPress: Join Project Midnight Sun! The next generation platform for community building with WordPress!

BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25490
    Brajesh Singh on in reply to: [Resolved] Problem to Setting Auto Friendship #36763

    Hi Emanuele,
    Thank you for confirming.

    I am sorry, there is no way to know in BuddyPress when a specific member type was removed. If you remove a member types, it uses set member type action. So,m we don’t have access to previous member type to determine if we should remove all friends.

    If you want, we can add the code for a condition like this. If a user’s member type is set to None(”), we remove all friends. It will apply for all member type though.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25490

    Hi Hgo,
    Thank you for the question.

    Is it about user profile tabs pro plugin? Unfortunately it does not support multilingual tab/content.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25490
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25490

    Hi Emanuele,
    Thank you for the patience.

    There was a minor update needed in the code.

    Here it is

    
    
    /**
     * Add as friend other user with same member type on user member change.
     */
    add_action( 'bp_set_member_type', function ( $user_id, $member_type ) {
    
    	$member_type = (array) $member_type;
    	if ( ! in_array( 'partner', $member_type ) ) {
    		return;
    	}
    
    	$users = new BP_User_Query(
    		array(
    			'member_type'     => 'partner',
    			'populate_extras' => false,
    		)
    	);
    	if ( ! $users->total_users ) {
    		return;
    	}
    
    	foreach ( $users->user_ids as $id ) {
    
    		if ( $id == $user_id ) {
    			continue;
    		}
    
    		if ( ! friends_check_friendship( $user_id, $id ) ) {
    			friends_add_friend( $id, $user_id, true );
    		}
    	}
    }, 10, 2 );
    

    It is working on the staging site now. I have put ti in the child theme’s functions.php

    Regards
    Brajesh

    PS:- I tested by changing a user’s member type, Please revert them.

  • Keymaster
    (BuddyDev Team)
    Posts: 25490

    Please add the rule and point me to the error page. If I can see the rule and then the error message, I can quickly fix it.

    I tried updating rule but it had no effect.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25490

    Hi Tiffany,
    Thank you for the suggestion. It will be part of our next release.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25490
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25490
    Brajesh Singh on in reply to: Buddy press profile tabs #36743

    You are welcome.

    If you have issues in using any normal shortcode, Please do let me know.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25490
    Brajesh Singh on in reply to: [Resolved] Problem to Setting Auto Friendship #36739

    Hi Emanuele,
    Thank you.

    Please do. That will help us check and update the code as needed.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25490
    Brajesh Singh on in reply to: [Resolved] Problem to Setting Auto Friendship #36737

    Hi Emanuele,
    Did you try to change a user’s member type after puttin the code from my last update?

    Regards
    Brajesh