BuddyDev

Search

BP Member Type Generator – Default Type

  • Participant
    Level: Initiated
    Posts: 2
    Allison on #3988

    I’m using Buddypress on a WordPress multisite install. My goal is to have different extended profile questions based on what site the user is a member of. I’ve achieved that by using the Member Type Generator plugin. Each of my sites has one member type ( site name – member). I want users to automatically be assigned to this type upon Woocommerce registration. Is there a way to do this? Members are not filling out their extended profile during Woocommerce registration. I don’t want people to register and go to their account and not see any profile fields because they have to wait on me to assign their type.

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #3989

    Hi Allison,
    Welcome to BuddyDev.
    Do you have any way to know which member type a user should be assigned at the time of registration. If yes, Then It can be easily done.

    Please let me know and I will post the code.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 2
    Allison on #3991

    EW Peer Group Member for one site and ACT1 Member for the other site. (It’s probably only necessary to post for one member type.)

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #3992

    Hi,
    Just to be clear, for member type the key is important(the unique key that you set while creating). To assign a user to a member type we need to know that unique key for the current site.

  • Participant
    Level: Initiated
    Posts: 2
    Allison on #3993
  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #4036

    Hi,
    I am sorry I missed your post. I will be putting code in next couple of hours.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #4039

    Hi Allison,
    Please use the following code

    
    function buddydev_set_membertype_on_wc_register( $user_id, $user_data ) {
    	//decide which member type
    	$member_type = "whatever";//PLEASE UPDATE IT
    
    	bp_set_member_type( $user_id, $member_type );
    }
    add_action( 'woocommerce_created_customer', 'buddydev_set_membertype_on_wc_register', 10, 2 );
    
    

    Please make sure to update the $member_type with the correct value and the user will be assigned the member type.

You must be logged in to reply to this topic.

This topic is: not resolved