Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing Group tab display defaults


  • snark
    Participant

    @snark

    Here’s what I’d like to do, if possible: On the home page for any given Group, instead of the activity stream being the default home page (called “Home”), I would like the Forum to be the default home page and be labeled “Forum” in the tab, with the Group activity stream tab just to the right of the new default “Forum” tab and labeled “Group Activity” in the tab.

    Here’s a clearer way to show what I mean:

    Current BP default — group Home page in bold:

    [Home] [Forum] [Members (4)] [Send Invites]

    Change to (this exact order and text):

    [Forum] [Group Activity] [Members (4)] [Send Invites]

    I want to try this method of navigation because I’ve already disabled forum topic commenting in the group activity stream, and I want to make the focus of each group on the forum — that’s where I want most of the post action, not in the group post area.

    How to go about doing this? Thanks.

Viewing 13 replies - 51 through 63 (of 63 total)
  • I’m also unable to get this to work. I just want to make ‘Forum’ the default tab in a group, and get rid of the ‘Home’ tab.


    Rob Sbaglia
    Participant

    @sbaglia

    Yes I’d really love some help on this. When I paste in Andrew’s code on the previous page, I get the error …

    Parse error: syntax error, unexpected ‘;’ in /home/xxxxx/public_html/xxxxxx/xxxxxxxx/wp-content/plugins/bp-custom.php on line 7


    peeld
    Participant

    @peeld

    The code here works:
    `/* Redirect BP group to forum tab rather than activity tab */
    function redirect_group_home() {
    global $bp;
    $path = clean_url( $_SERVER );
    $path = apply_filters( ‘bp_uri’, $path );
    if (bp_is_group_home() && strpos( $path, $bp->bp_options_nav[$bp->groups->current_group->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]);
    }
    }
    //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’);`

    However, it renders the activity update button useless (i.e. can’t post activity updates in a group!). Removing the code from bp-custom makes group activity updates work, putting it back in breaks activity updates :( Any hints?


    ewebber
    Participant

    @ewebber

    I’ve just set up a brand new BP site (1.5.5.) and can’t get this to work at all. Does anyone have it working on 1.5.5? Thanks

    Sure enough, @peeld, your code A) set FORUMS as the default tab, and B) broke the activity updates! Thanks for the help!

    I don’t actually mind losing the activity updates, but I’m sure most folks’ projects could benefit from a solution here that didn’t break that function.

    Anyone have input here?


    zillabuggs
    Participant

    @zillabuggs

    I am sick of banging my head against a brick wall to get this to happen. Even to the point of beginning to wish I’d never opted to use this for my site at all.

    I’m using WP 3.4.1 and BP 1.5.6. I cannnot get this to work. It’s all I need now to get my site working as I’d like. Please can someone help?


    k12onos
    Participant

    @k12onos

    I came up with this on WP 3.4.1 and BP 1.6:
    `

    function redirect_to_forum() {
    global $bp;

    $path = esc_url( $_SERVER );

    $gpath = esc_url( bp_get_group_permalink( $bp->groups->current_group ));

    if ( bp_is_group_home() && strpos( $path, $gpath ) === false ) {
    bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . ‘/forum/’ );

    }
    }

    add_action( ‘wp’, ‘redirect_to_forum’ );
    `

    I’m not sure whether this is an optimal/efficient code, I just wrote what works..

    Is there anyone here that knows how to improve it? Does this redirect code burdens the server at all? I’m concerned with how the redirect will heighten the server load when multiple users open group pages. I’m on a shared hosting so this is something that needs to be considered..


    danbpfr
    Participant

    @chouf1

    If you use BP 1.6.x you can find here some new improvements
    https://codex.buddypress.org/extending-buddypress/changing-internal-configuration-settings/


    k12onos
    Participant

    @k12onos

    Hi @Chouf1,

    that actually works very well! Since now there isn’t any redirection the page loads without a redirection delay too. Thanks a lot for pointing that page out!

    (Edit)

    After using
    `
    define( ‘BP_GROUPS_DEFAULT_EXTENSION’, ‘forum’ );
    `

    I found this repeating over and over again in my error log:
    `
    [20-Aug-2012 18:56:13] PHP Warning: call_user_func_array(): First argument is expected to be a valid callback, ‘redirect_to_forum’ was given in /home2/public_html/wp-includes/plugin.php on line 484
    `

    I’m not sure what I should do now.. any clue?

    Edit:

    Sorry, this was caused by my silly mistake of forgetting to delete
    `
    add_action( ‘wp’, ‘redirect_to_forum’ );
    `


    zillabuggs
    Participant

    @zillabuggs

    Sorry guys, I must be incredibly thick, so I’m giving up on trying to get this to happen for me. I can’t get any of the above solutions to work so might just try to remove the what’s new box on the home page instead.


    modemlooper
    Moderator

    @modemlooper

    @boone

    What changed with bp_options_nav?

    bp_options_nav = ‘new_name’;

    no longer works, neither does position

    EDIT: nvrmd found your blog post http://bpdevel.wordpress.com/2011/09/05/manually-modifying-single-group-navigation-in-bp-1-5/

    looks like codex needs and update.

    for those searching:

    `$bp->bp_options_nav[$bp->groups->current_group->slug] = ‘New Name’;`


    Leonyipa
    Participant

    @leonyipa

    I tried all the codes but none of them works, please help!


    kalico
    Participant

    @kalico

    I ended up (mostly) resolving this issue by using the Commons in a Box plugin. It has two checkboxes in the “Settings” area that allow you to set the Group and Member default tabs to “Forums” and “Profile”, respectively. Lifesaver.

Viewing 13 replies - 51 through 63 (of 63 total)
  • The topic ‘Changing Group tab display defaults’ is closed to new replies.
Skip to toolbar