The groups extension API is meant to add a new tab to the groups interface. If by “create extra fields” you mean that you want to add additional metadata to the Group Details tab, here is some code from a client project I once did. I’ve modified it a bit to remove some custom functions. This should give you an idea of how to start.
add_filter( 'groups_custom_group_fields_editable', 'group_details_markup' );
add_action( 'groups_group_details_edited', 'group_details_save' );
add_action( 'groups_created_group', 'group_details_save' );
function group_details_markup() {
$group_links = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_links' );
extract( $group_links );
$group_text = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_text' );
?>
<label for="group-text">Restaurant Description</label>
<p>(Type of food, etc)</p>
<textarea name="group-text" id="group-text"><?php echo $group_text ?></textarea>
<label for="group-price">Restaurant Price</label>
<?php $price = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_price' ); ?>
<select name="group-price">
<option value="1" <?php if ( $price == '1' ) : ?>selected="selected"<?php endif ?>>$</option>
<option value="2" <?php if ( $price == '2' ) : ?>selected="selected"<?php endif ?>>$$</option>
<option value="3" <?php if ( $price == '3' ) : ?>selected="selected"<?php endif ?>>$$$</option>
<option value="4" <?php if ( $price == '4' ) : ?>selected="selected"<?php endif ?>>$$$$</option>
<option value="5" <?php if ( $price == '5' ) : ?>selected="selected"<?php endif ?>>$$$$$</option>
</select>
<?php $url = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_url' ); ?>
<label for="group-url">Restaurant Website</label>
<input type="text" name="group-url" id="group-url" value="<?php echo $url ?>" />
<?php $phone = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_url' ); ?>
<label for="group-phone">Restaurant Phone Number</label>
<input type="text" name="group-phone" id="group-phone" value="<?php echo $phone ?>" />
<label for="group-menupages">MenuPages</label>
<input type="text" name="group-menupages" id="group-menupages" value="<?php echo $MenuPages ?>" />
<label for="group-yelp">Yelp</label>
<input type="text" name="group-yelp" id="group-yelp" value="<?php echo $Yelp ?>" />
<label for="group-chow">Chow</label>
<input type="text" name="group-chow" id="group-chow" value="<?php echo $Chow ?>" />
<label for="group-everyblock">Everyblock</label>
<input type="text" name="group-everyblock" id="group-everyblock" value="<?php echo $EveryBlock ?>" />
<?php
return;
}
function group_details_save( $group_id ) {
global $bp, $wpdb;
$plain_fields = array(
'url',
'phone',
'text',
'price'
);
$links_fields = array(
'menupages' => 'MenuPages',
'yelp' => 'Yelp',
'chow' => 'Chow',
'everyblock' => 'EveryBlock'
);
foreach( $plain_fields as $field ) {
$key = 'group-' . $field;
if ( isset( $_POST[$key] ) ) {
$value = $_POST[$key];
groups_update_groupmeta( $group_id, 'e2e_' . $field, $value );
}
}
$links = array();
foreach( $links_fields as $fn => $name ) {
$key = 'group-' . $fn;
if ( isset( $_POST[$key] ) ) {
$links[$name] = $_POST[$key];
}
}
groups_update_groupmeta( $group_id, 'e2e_links', $links );
// Prevent null searches by entering dummy values for important meta
if ( !groups_get_groupmeta( $group_id, 'bpgr_rating' ) )
groups_update_groupmeta( $group_id, 'bpgr_rating', 'null' );
if ( !groups_get_groupmeta( $group_id, 'bpgr_how_many_ratings' ) )
groups_update_groupmeta( $group_id, 'bpgr_how_many_ratings', 'null' );
if ( !groups_get_groupmeta( $group_id, 'e2e_price' ) )
groups_update_groupmeta( $group_id, 'e2e_price', 'null' );
}