Hey @davidveldt this should do it if you are using the default theme. Otherwise you should integrate as you see fit.
theme/registration/register.php
You can add any groups or fields as you require. The groups and fields here are arbitrary.
<?php $roles = array(2 => 'player', 4 => 'coach', 5 =>'parent', 6 => 'instructor'); ?>
<div id="roles">
<?php foreach($roles as $key => $role) : ?>
<div id="<?php echo $role; ?>" class="role-fields">
<?php if(bp_has_profile('profile_group_id='.$key)) : while(bp_profile_groups()) : bp_the_profile_group(); ?>
<?php while(bp_profile_fields()) : bp_the_profile_field(); ?>
<div class="editfield">
<?php if('textarea' == bp_get_the_profile_field_type()) : ?>
<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
<textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_edit_value() ?></textarea>
<?php endif; ?>
<?php do_action( 'bp_custom_profile_edit_fields' ) ?>
<p class="description"><?php bp_the_profile_field_description() ?></p>
</div>
<?php endwhile; ?>
<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_group_field_ids() ?>" />
<?php endwhile; endif; ?>
</div>
<?php endforeach; ?>
</div>
Create some profile groups to cater for each role. You can find the group id within the BuddyPress admin… In the url bar or investigate your database.
You should set-up the $roles array above to match your requirements.
Within the loop you can show any fields you have created within that xprofile group. If you have a select box within that group you would add the following code as outlined in the bp-default register.php
<?php if ( 'selectbox' == bp_get_the_profile_field_type() ) : ?>
<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ) ?><?php endif; ?></label>
<?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ) ?>
<select name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>">
<?php bp_the_profile_field_options() ?>
</select>
<?php endif; ?>
Finally add the following jQuery where you house any other code of similar ilk.
<script>
jQuery(".role-fields").hide();
$roles = jQuery("#roles");
jQuery("#field_2").change(function()
{
$role = jQuery(this).val().toLowerCase();
jQuery(".role-fields").hide();
jQuery("#" + $role).toggle();
});
</script>
Here’s a pastebin for all that above. http://pastebin.com/QFdTdstz
No need for tabs or accordion this time.
Hope that helps you on the Road.