function sync_mp_subspecialties_to_bp( $user_id ) { if ( isset( $_POST['userdata']['subspecialties'] ) ) { $lines = explode( "\n", sanitize_textarea_field( $_POST['userdata']['subspecialties'] ) ); $subspecs = array(); foreach ( $lines as $line ) { $parts = explode( ',', $line ); if ( count( $parts ) == 2 ) { $subspecs[] = array( 'specialty' => trim( $parts[0] ), 'year' => trim( $parts[1] ) ); } } // Serialize for BP repeater (field ID: inspect profile edit page) xprofile_set_field_data( 456, $user_id, serialize( $subspecs ) ); // Replace 456 } } add_action( 'mepr-signup-after', 'sync_mp_subspecialties_to_bp' ); add_action( 'mepr-checkout-complete', 'sync_mp_subspecialties_to_bp' );