BuddyDev

Search

Member Type Email & Configuration

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

    Mr. Brajesh,

    Love your handy work. You are quite the talented man and I’m looking forward to availing your contributions for my own efforts. I’m just starting out with Buddypress and love how much of an impact your plugins have had on the functionality! God bless your efforts.

    Having said that, I have been using your “Member Type” plugin for a little while and I LOVE it. The website I’m working on doesn’t have an ideal configuration due to a number of incompatibilities. However, regardless, I’m making it work. I was amazed to find that your you created a “xProfile Member Type Field” plugin to fill in the gap which would automatically apply the member type! I was so excited about this setup but was really disappointed when I discovered I couldn’t use it. The registration plugin I use does not map to any other field except the xprofile native fields.

    I was wondering if there was a function I could use to apply the member type to new members automatically using a meta value from another field like gender, upon registration. This would give me the automatic workaround needed without me having to manually apply the member type to each member after registration.

    Secondly, I’m not sure if this has been discussed (I searched and couldn’t find something exactly), but it would be awesome if a email notification was attached to member types. Meaning, in my case, I’m working with a match-making site and if man registers, a women could be notified of a new male member and vise-versa. I can see a bunch of other similar use cases for such a notification. Personally this would be an awesome addition to the plugin!

    I look forward to working with you!

    Thank you again for your awesome work.

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

    🙁

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #9465

    Hi Mohammad,
    Thank you for the kind words and my apologies for the delayed reply.

    1. You can set the member type of a user using the following

    
    
    bp_set_member_type( $user_id, 'member_type_name' );
    
    

    2. Tough I agree with you about it, and I do understand that it will make it significantly better, Our team won’t be able to work n it. It is something that should be part of BuddyPress core. I will suggest opening a ticket at BuddyPress trac for this.

    Thank you
    Brajesh

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

    Excellent idea about the email. That would be an ideal route to take to add this feature that everyone can enjoy.

    Thank you for the snippet. I tried to add it on its own in the bp-custom file but it crashes the site. I would ideally like the member type to conditionally attach the gender field time. If male/female is selected upon user creation, the appropriate member type should be applied.

    Is this possible?

    Thanks again!

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2935
    Ravi on #9489

    Hello Mohammad,

    Brajesh sir is away that is why I am posting here. Try the following code in your bp-custom.php file and let me know if it works or not.

    
    function buddydev_assign_member_type_on_registration( $user_id ) {
    
    	// replace =gender with your field name
    	$gender = $_POST['gender'];
    
    	if ( ! empty( $gender ) ) {
    		if ( 'male' == $gender ) {
    			bp_set_member_type( $user_id, 'member_type_name' );
    		} elseif ( 'female' == $gender ) {
    			bp_set_member_type( $user_id, 'member_type_name' );
    		}
    	}
    }
    add_action( 'user_register', 'buddydev_assign_member_type_on_registration', 10, 1 );
    
    

    Thank You
    Ravi

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

    Ravi!

    Thank you so much for that solution. I tried it but it didn’t work 🙁 I observed the existing members that weren’t assigned a member type and tried creating a new member to see if that would make it work. Unfortunately, it doesn’t work in either case.

    I can see that you are using the “gender” key to assign the member type but does it need to be explicitly defined like if gender is “male”, make member type “male”. The member types are exactly the same values as the gender field.

    Thanks again!

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #9494

    Thank you Ravi.


    @khangp
    ,
    can you please point to your registration form? That will make it easy for us to see how to do it.

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

    Hi Brajesh,

    Thank you for trying to help me figure this out.

    The registration in question can be found at http://baraatmatrimonial.com/arm_register

    Thanks again.

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

    Hello again!

    It’s been a while since I revisited this. Your help will be greatly appreciated! The last code unfortunately did not work 🙁

    Thank you!

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #13216

    Hi Mohamad,
    I checked your site and you seems to be using Angular Js on client side and most probably have a custom registration step.

    The above code by Ravi will work if it was a normal form submission.

    What are you suing for registration? If it is a custom buit page, It will be easier to directly call a little modified version of the function ‘buddydev_assign_member_type_on_registration’ with the user id and gender as parameter.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved