Wordpress

<?php $formloop = 0; ?>
<?php if ( bp_is_active( ‘xprofile’ ) ) : if ( bp_has_profile( ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
<?php
if (bp_get_the_profile_group_id() != $formloop) {
$formloop = bp_get_the_profile_group_id();
$newfieldset = TRUE;
?>
<fieldset id="xprofile_<?php echo bp_get_the_profile_group_slug() ?>">
<legend><?php echo bp_get_the_profile_group_name() ?></legend>
<?php
}
?>
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<?php$formlist[] = bp_get_the_profile_field_id(); ?>

—– Continue with the form code —-

<?php endwhile; ?>
<?php
if ($newfieldset == TRUE) {
$newfieldset = FALSE;
?>
</fieldset>
<?php
}
?>
<?php endwhile; endif; endif; ?>
<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php echo implode(",", $formlist); ?>" />