Skip to:
Content
Pages
Categories
Search
Top
Bottom

Update Member Type on profile save


  • psmorrow
    Participant

    @psmorrow

    Hi Everyone,
    I am trying to update member type on profile save, but can’t get it to work. I am able to create member types correctly:

    function bbg_register_member_types_with_directory() {
        bp_register_member_type( 'current-student', array(
            'labels' => array(
                'name'          => 'Current Students',
                'singular_name' => 'Current Student',
            ),
            'has_directory' => 'current-students'
        ) );
    	 bp_register_member_type( 'future-student', array(
            'labels' => array(
                'name'          => 'Future Students',
                'singular_name' => 'Future Student',
            ),
            'has_directory' => 'future-students'
        ) );
    }
    add_action( 'bp_register_member_types', 'bbg_register_member_types_with_directory' );
    

    But, can’t seem to set member type on profile save. Here’s my code:

    
    function action_xprofile_field_after_save( $array ) { 
    
    	$user_id = bp_displayed_user_id();
    	bp_set_member_type( $user_id, 'current-student' );
    }
             
    add_action( 'xprofile_field_after_save', 'action_xprofile_field_after_save', 10, 1 ); 
    

    Any suggestions?

Viewing 1 replies (of 1 total)

  • psmorrow
    Participant

    @psmorrow

    I got this working instead:

    function action_xprofile_data_after_save( $array ) { 
    
    		bp_set_member_type( get_current_user_id(), 'current-student', false );	
    }
             
    
    add_action( 'xprofile_data_after_save', 'action_xprofile_data_after_save', 10, 1 );
    
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar