Reputation: 10176
I want to conditionally add a step in the Group Creation wizard of Buddypress / Buddyboss. In step 2 my form asks for a specific field (via a Select-box with the HTML name "group-types[]").
Whenever a specific group type is clicked and the user clicks "next step", I want to add a new step inbetween conditionally on the group type field.
I found this code: https://gist.github.com/shanebp/c9cdde9443bdeab9b4ca
It works, but there are two things: I'm not sure where exactly to "ask" the already made settings for the group in the creation wizard and unfortunately the settings-page "Ville" is added at the end.
I tried to set a "position"-element in the $arg which is passed to parent::init( $args ); but this is not accepted.
Any help would be highly appreciated.
Upvotes: 0
Views: 312
Reputation: 1956
ville is an arbitrary term. I've updated the gist to use test. Replace it with whatever you want. The Test step will appear after the Settings step and will check for any group types selected in the Settings step.
You can get all the group type data as an object:
$group_types = bp_groups_get_group_type( $group_id, false );
if ( is_array( $group_types ) ) {
foreach ( $group_types as $group_type ) {
$group_object = bp_groups_get_group_type_object( $group_type );
var_dump( $group_object );
}
} else {
$group_object = bp_groups_get_group_type_object( $group_types );
var_dump( $group_object );
}
Upvotes: 1