Change BuddyPress Groups Starting Tab

OK So after a LOT of searching and looking through out dated posts I finally figured out how to make the BuddyPress groups main page default to the forums tab instead of the home tab which is confusing because commenting is enabled, even when I have it turned off.

Here is the code for BuddyPress 1.5 and I hope it helps. Note that this can be used in either your bp-custom.php file which HAS to be located in wp-content/plugins/ OR your themes functions.php file.

/* Redirect for group home tab */
function redirect_group_home() {
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[$bp->groups->current_group->slug]['home']['slug'] ) === false ) {
if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == 'public') {
bp_core_redirect( $path . 'forum/' );
}
}
}
function move_group_activity_tab() {
global $bp;
if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) {
unset($bp->bp_options_nav[$bp->groups->current_group->slug]['home']);
}
}
//The following line redirects to a group forum page rather than a group activity page
add_action('bp_init', 'redirect_group_home' );
//The following line removes the group activity tab entirely
//add_action('bp_init', 'move_group_activity_tab');

About Tommy White 140 Articles
Welcome! My Name is Tommy White and I do what it takes to get it done. I offer my services to anyone in need. I specialized in Graphic Design Management, Web Development, Promotion, and IT Services.

3 Comments

    • You could try the following in functions.php or bp-custom.php. The bp-custom.php file will need to be created and placed directly in the plugins folder if you want to use it.

      function remove_group_options()
      {
      global $bp;
      $parent_slug = isset( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ? $bp->groups->current_group->slug : $bp->groups->slug;
      bp_core_remove_nav_item( $parent_slug, 'eventos' );
      bp_core_remove_nav_item( $parent_slug, 'group-events' );
      }
      add_action( 'bp_setup_nav', 'remove_group_options' );

Leave a Reply

Your email address will not be published.


*