Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I make the My Groups tab default rather than Groups tab?

  • Avatar of Christine
    Christine
    Participant

    @mossyoak

    Hi there

    When I’m on the Groups page it defaults to show groups, but I would like it to default show “My Groups” as I use hidden groups a lot and if a user logs in it might look like there are no groups to them and it’s not obvious to click the My Groups Tab.

    If anyone has a good solution that does not involve hacking into the BuddyPress plugin but can be done with a function or plugin that would be great :)
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Christine
    Christine
    Participant

    @mossyoak

    I found this code from http://www.tommywhite.com/resources/buddypress/change-buddypress-groups-starting-tab after some Google searching- does anyone know if this is a good way of doing this in the latest version of BuddyPress please?

    /* 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');
    Avatar of Christine
    Christine
    Participant

    @mossyoak

    Actually forget this- It seems to be working ok now without any tweaks- strange, perhaps it was my theme.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.