Creating a custom tab in the groups page is quite simple, all it takes is a added code to the bp-custom.php file:
`class My_Group_Extension extends BP_Group_Extension {
function my_group_extension() {
$this->name = ‘My Group Extension’;
$this->slug = ‘my-group-extension’;
$this->create_step_position = 21;
$this->nav_item_position = 31;
}
function create_screen() {
if ( !bp_is_group_creation_step( $this->slug ) )
return false;
?>
The HTML for my creation step goes here.
<?php
wp_nonce_field( ‘groups_create_save_’ . $this->slug );
}
function create_screen_save() {
global $bp;
check_admin_referer( ‘groups_create_save_’ . $this->slug );
/* Save any details submitted here */
groups_update_groupmeta( $bp->groups->new_group_id, ‘my_meta_name’, ‘value’ );
}
function edit_screen() {
if ( !bp_is_group_admin_screen( $this->slug ) )
return false; ?>
name ) ?>
Edit steps here
<?php
wp_nonce_field( ‘groups_edit_save_’ . $this->slug );
}
function edit_screen_save() {
global $bp;
if ( !isset( $_POST ) )
return false;
check_admin_referer( ‘groups_edit_save_’ . $this->slug );
/* Insert your edit screen save code here */
/* To post an error/success message to the screen, use the following */
if ( !$success )
bp_core_add_message( __( ‘There was an error saving, please try again’, ‘buddypress’ ), ‘error’ );
else
bp_core_add_message( __( ‘Settings saved successfully’, ‘buddypress’ ) );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . ‘/admin/’ . $this->slug );
}
function display() {
/* Use this function to display the actual content of your group extension when the nav item is selected */
}
function widget_display() { ?>
name ) ?>
You could display a small snippet of information from your group extension here. It will show on the group
home screen.
<?php
}
}
bp_register_group_extension( ‘My_Group_Extension’ );
`
edit the: $this->name = ‘My Group Extension’;
$this->slug = ‘my-group-extension’;
to the names and slugs of your likings.