Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: New Group creation fields


Boone Gorges
Keymaster

@boonebgorges

Basically, you’ll need two functions to make it happen. One will create the form markup, and the other will process the data. Here’s a skeleton:

`function bbg_extra_group_fields_markup() {
// Put your form markup here, eg:
?>

<?php
}
add_action( ‘groups_custom_group_fields_editable’, ‘bbg_extra_group_fields_markup’ );`

That’ll insert the fields into the group admin page. Keep in mind that you might want to echo the current value in the value=”” field. Then:

`function bbg_save_extra_group_details() {
// Grab the $_POST data and do something with it. Simplified example:
global $bp;
if ( isset( $_POST ) )
groups_update_groupmeta( $bp->groups->current_group->id, ‘country’, $_POST );
}
add_action( ‘groups_group_details_edited’, ‘bbg_save_extra_group_details’ );
add_action( ‘groups_create_group_step_save_group-details’, ‘bbg_save_extra_group_details’ );`

That’s untested, so you might need to do some finagling to make it work for both group creation and editing. But that should give you an idea.

Skip to toolbar