<?php
function redirect_to_forum() {
global $bp;
$path = clean_url( $_SERVER['REQUEST_URI'] );
$path = apply_filters( 'bp_uri', $path );
if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false ) {
if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
}
}
}
add_action( 'wp', 'redirect_to_forum' );
function my_bp_groups_forum_first_tab() {
global $bp;
if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
$bp->bp_options_nav['groups']['home']['position'] = '50';
$bp->bp_options_nav['groups']['home']['name'] = 'Activity';
}
}
add_action('wp', 'my_bp_groups_forum_first_tab');
?>