BuddyDev

Search

Member Type Email & Configuration

  • Keymaster
    (BuddyDev Team)
    Posts: 24075
    Brajesh Singh on #13302

    Hi Mohammad,
    Thank you.

    Looks like

    
    arm_after_add_new_user
    

    Is the correct hook. I will post a solution with it today and then you can check and see if it works.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Mohammad on #13316

    Awesome!

    I can’t wait to try it!

  • Keymaster
    (BuddyDev Team)
    Posts: 24075
    Brajesh Singh on #13369

    Hi Mohammad,
    Sorry, I kept you waiting for such a long time.

    Please use the updated code

    
    
    function buddydev_assign_member_type_on_registration( $user_id, $data ) {
    
    	// replace =gender with your field name
    	$gender = isset( $data['gender'] ) ? $data['gender'] : '';
    
    	if ( ! empty( $gender ) ) {
    		if ( 'male' == $gender ) {
    			bp_set_member_type( $user_id, 'member_type_name' ); // please change member type with valid member type.
    		} elseif ( 'female' == $gender ) {
    			bp_set_member_type( $user_id, 'member_type_name' ); // please change member type with valid member type.
    		}
    	}
    }
    add_action( 'arm_after_add_new_user', 'buddydev_assign_member_type_on_registration', 10, 2 );
    
    

    Please make sure to change the member_type_name with appropriate member types(The unique name/key) as registered.

    Also, if it does not work in bp-custom.php, please put it in your theme’s functions.php

    Please let me know how it goes.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Mohammad on #13494
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24075
    Brajesh Singh on #13533
    This reply has been marked as private.

You must be logged in to reply to this topic.

This topic is: not resolved