• Resolved Anonymous User 16484011

    (@anonymized-16484011)


    Hi !

    Very very good plugin

    In my site I create two member type Doctor and Patient. I want to assign by default member type Patient to new registered user via my buddy press by default new user registration page.

    How can I do the same ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Brajesh Singh

    (@sbrajesh)

    Thank you for the question and using this plugin.

    Please add this code in your bp-custom.php

    
    
    /**
     * Set default member type for user on account activation.
     *
     * @param int $user_id user id.
     */
    function buddydev_set_default_membertype_on_user_activation( $user_id ) {
    
    	// User already has member type.
    	if ( bp_get_member_type( $user_id, true ) ) {
    		return;
    	}
    
    	$default_member_type = 'student';// change it with actual member type(unique name).
    
    	bp_set_member_type( $user_id, $default_member_type );
    }
    
    add_action( 'bp_core_activated_user', 'buddydev_set_default_membertype_on_user_activation', 11 );
    
    

    Also, change the default member type from student to your own member type.

    Hope that helps.

    Regards
    Brajesh

    Thread Starter Anonymous User 16484011

    (@anonymized-16484011)

    First of all thank you for your answer.

    I read your answer and check that there is no bp-custome.php file in buddy press plugin directory. So, I googled …

    AND I do below steps. Tell me if any wrong.

    1. Create new bp-custom.php file.
    2. Paste your above code in it.
    3. Put this file on wp-custom/plugins folder.

    Thanks

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi,
    Please put bp-custom.php in your wp-content/plugins directory and not in buddypress plugins’s directory.

    Regards
    Brajesh

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to assign by default member type for new user’ is closed to new replies.