Index: bp-themes/bp-default/groups/single/admin.php
===================================================================
--- bp-themes/bp-default/groups/single/admin.php (revision 4077)
+++ bp-themes/bp-default/groups/single/admin.php (working copy)
@@ -86,7 +86,13 @@
+
+
+
+
+
+
Index: bp-themes/bp-default/groups/single/home.php
===================================================================
--- bp-themes/bp-default/groups/single/home.php (revision 4077)
+++ bp-themes/bp-default/groups/single/home.php (working copy)
@@ -29,6 +29,18 @@
+
+
+
+
-
-
-
-
Index: bp-groups/bp-groups-screens.php
===================================================================
--- bp-groups/bp-groups-screens.php (revision 4077)
+++ bp-groups/bp-groups-screens.php (working copy)
@@ -481,12 +481,13 @@
$enable_forum = ( isset($_POST['group-show-forum'] ) ) ? 1 : 0;
$allowed_status = apply_filters( 'groups_allowed_status', array( 'public', 'private', 'hidden' ) );
$status = ( in_array( $_POST['group-status'], (array)$allowed_status ) ) ? $_POST['group-status'] : 'public';
+ $home_content = !empty( $_POST['group-home-content'] ) ? $_POST['group-home-content'] : 'members';
// Check the nonce
if ( !check_admin_referer( 'groups_edit_group_settings' ) )
return false;
- if ( !groups_edit_group_settings( $_POST['group-id'], $enable_forum, $status ) ) {
+ if ( !groups_edit_group_settings( $_POST['group-id'], $enable_forum, $status, $home_content ) ) {
bp_core_add_message( __( 'There was an error updating group settings, please try again.', 'buddypress' ), 'error' );
} else {
bp_core_add_message( __( 'Group settings were successfully updated.', 'buddypress' ) );
Index: bp-groups/bp-groups-functions.php
===================================================================
--- bp-groups/bp-groups-functions.php (revision 4077)
+++ bp-groups/bp-groups-functions.php (working copy)
@@ -118,7 +118,7 @@
return true;
}
-function groups_edit_group_settings( $group_id, $enable_forum, $status ) {
+function groups_edit_group_settings( $group_id, $enable_forum, $status, $home_content = 'members' ) {
global $bp;
$group = new BP_Groups_Group( $group_id );
@@ -144,6 +144,9 @@
}
}
+ // Save the home content
+ groups_update_groupmeta( $group->id, 'group-home-content', $home_content );
+
groups_update_groupmeta( $group->id, 'last_activity', bp_core_current_time() );
do_action( 'groups_settings_updated', $group->id );
Index: bp-groups/bp-groups-template.php
===================================================================
--- bp-groups/bp-groups-template.php (revision 4077)
+++ bp-groups/bp-groups-template.php (working copy)
@@ -513,6 +513,31 @@
return apply_filters( 'bp_get_group_date_created', bp_core_time_since( strtotime( $group->date_created ) ) );
}
+function bp_group_locate_default_template() {
+
+ $default_template = groups_get_groupmeta( bp_get_group_id(), 'group-home-content' );
+
+ if ( empty( $default_template ) ) {
+ $default_template = 'front';
+
+ if ( bp_group_is_visible() ) {
+ if ( bp_is_active( 'activity' ) ) {
+ $default_template = 'activity';
+ } else if ( bp_is_active( 'forums' ) ) {
+ $default_template = 'forum';
+ } else {
+ $default_template = 'members';
+ }
+ }
+ }
+
+ $default_template = 'groups/single/' . $default_template . '.php';
+
+ $default_template = apply_filters( 'bp_group_locate_default_template', $default_template );
+
+ locate_template( array( $default_template ), true );
+}
+
function bp_group_is_admin() {
global $bp;
@@ -1069,6 +1094,55 @@
__( 'Members', 'buddypress' )
+ );
+
+ if ( bp_is_active( 'activity' ) ) {
+ $group_tabs['activity'] = __( 'Activity', 'buddypress' );
+ }
+
+ if ( bp_is_active( 'forums' ) ) {
+ $group_tabs['forum'] = __( 'Forum', 'buddypress' );
+ }
+
+ // Now, loop through the options nav to look for others tabs added by plugins
+ // Check against a list of tabs that cannot be set to the Home tab (keyed by slug)
+ $home_tab_exceptions = apply_filters( 'bp_group_home_tab_exceptions', array(
+ 'admin',
+ 'home'
+ ) );
+
+ foreach( $bp->bp_options_nav[$bp->groups->current_group->slug] as $nav_item ) {
+ if ( !array_key_exists( $nav_item['slug'], $group_tabs ) && !in_array( $nav_item['slug'], $home_tab_exceptions ) ) {
+ $group_tabs[$nav_item['slug']] = $nav_item['name'];
+ }
+ }
+
+ $group_tabs = apply_filters( 'bp_group_home_options_tabs', $group_tabs );
+
+ // Build the options markup
+ $options = array();
+ $current_home_content = groups_get_groupmeta( bp_get_group_id(), 'group-home-content' );
+ if ( empty( $current_home_content ) ) {
+ $current_home_content = 'members';
+ }
+ foreach( $group_tabs as $slug => $name ) {
+ $selected = $current_home_content == $slug ? ' selected="selected"' : '';
+ $options[] = "\t\t" . '';
+ }
+
+ $select_markup = '';
+
+ echo apply_filters( 'bp_group_home_options_markup', $select_markup, $options );
+}
+
function bp_group_total_for_member() {
echo bp_get_group_total_for_member();
}