BuddyDev

Search

BuddyPress Member Types Pro Removal Sync with LearnDash Groups

Tagged: 

  • Participant
    Level: Enlightened
    Posts: 31
    Amir on #34720

    Hi,

    We use the BuddyPress Member Types Pro plugin to add users to LearnDash groups according to their Member Type. We assigned each single member type to a single LearnDash group. The way we add users to member types is wither through the following methods:
    Gravity Forms
    Manually
    Programatically
    Bulk editing
    Directly through the DB

    My question is if we can also remove a user from a LearnDash group once we remove the user from the corresponding member type. Can you please advise if this is possible with the plugin?

    P.S. I know that there is a feature in the plugin that removes all other LD groups, but that is a different process than what I’m looking for.

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #34724

    Hi Amir,
    Thank you for the question.

    I believe this is doable.

    I will need need a day to put the time(or ask someone form the team to do so). You will still need to test as we do not use Learndash in our day to day operations.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 31
    Amir on #34727

    Hi Brajesh,

    Once again, your support is much appreciated.
    The least I can do is test the feature on my end.

    I can also provide you with a copy of our latest LearnDash version if you may find it helpful.

    Thanks!
    Amir.

  • Participant
    Level: Enlightened
    Posts: 31
    Amir on #34768

    Hi Brajesh,

    Is there anything we can do to advance this request?

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #34773

    Hi Amir,
    Please try this code

    
    /**
     * Remove associated groups when member type is removed.
     * It will not fire if member type is changed.
     */
    add_action( 'bp_remove_member_type', function ( $user_id, $member_type ) {
    
    	if ( ! function_exists( 'bpmtp_get_active_member_type_entries' ) || ! function_exists( 'ld_update_group_access' ) ) {
    		return;
    	}
    
    	$active_types = bpmtp_get_active_member_type_entries();
    
    	if ( empty( $member_type ) || empty( $active_types ) || empty( $active_types[ $member_type ] ) ) {
    		return;
    	}
    
    	$mt_object = $active_types[ $member_type ];
    
    	$group_ids = get_post_meta( $mt_object->post_id, '_bp_member_type_ld_groups', true );
    
    	if ( empty( $group_ids ) ) {
    		return;
    	}
    
    	foreach ( $group_ids as $group_id ) {
    		ld_update_group_access( $user_id, $group_id, true );
    	}
    
    }, 10, 2 );
    

    Please do note that this code may not work in BuddyPress member Types Pro 1.5.0 coming out this week(when we move away from post type).

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 31
    Amir on #34782

    Hi Brajesh,

    Thank you so much for your kind support.
    I just wanted to verify, should I add this code to the theme functions.php file? Or to the plugin?

    Also, I’m concerned regarding what you mentioned about the 1.5 release. We have a large registration workflow based on the member types the way they are so I have a few questions:

    1. How the member types will be configured in 1.5.0?
    2. Do you have an estimate of when it is scheduled for release?
    3. Will the removal functionality we discussed work natively in 1.5.0? If not, can we order that functionality from you so it will be inherited in the plugin?

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #34784

    Hi Amir,
    Thank you for the reply.

    1. Member Types Pro 1.5.0 is for BuddyPress 7.0 or above. In BuddyPress 7.0, there is native UI for creating members types, we are moving our additional functionalities to it.

    2. Yes, within a week.

    3. The problem is we have use get_post_meta in some of the custom codes. These custom codes like above will stop working. Other than that, the plugin and its functionalities will work without any issue.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 31
    Amir on #34786

    Great, it was very important for me to understand that our current setup will keep working after we update to Member Types Pro 1.5.0 and Buddypress 7. thank you for verifying.

    I also understand the removal functionality you described will not fit the future setup.
    Can we order this functionality so you’ll develop it and include it in the official upcoming release?
    Can you send a quote to the email under my account?

    Thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 24645
    Brajesh Singh on #34810

    Hi Amir,
    Thank you.

    I will get in touch tomorrow.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 31
    Amir on #35068

    Hi Brajesh,

    It seems I have not received your input on this. Did you have a chance to review it?

    Thanks!

You must be logged in to reply to this topic.

This topic is: not resolved