Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Control default 'landing' tab on a group-by-group basis


  • jeffacubed
    Participant

    @jeffacubed

    I’m pretty sure this exact topic-question hasn’t come up (but if it has, my apologies).

    Q: Is there a way, via the bp-custom.php file, to control the default ‘landing’ tab for buddypress groups on a group by group basis? For example:

    Group-1 > default landing tab ‘home’
    Group-2 > default landing tab ‘forum’
    Group-2 > default landing tab ‘members’
    etc…

    Using define( ‘BP_GROUPS_DEFAULT_EXTENSION’, ‘forum’ ); works 100% in the bp-custom.php file (for example, to change the default group landing tab to ‘forum’), but applies the new default landing tab to all groups. I just need a finer-control-method to manage the default landing tab on a group-by-group basis?

    My ‘gut’ tells me that a number of folks here have already tackled/solved this, so hopefully someone has some insight/suggestions on the best way(s) to tackle this.

    I’ve read through this topic (Changing Group tab display defaults) extensively but I just could not bend any of that code to solve the specific group-control issue I’ve mentioned above.

    Jeff

    @jeffacubed

    Wordpress 3.5.1 (multisite), Buddypress 1.6.4, bbpress 2.2.4

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

  • Brajesh Singh
    Participant

    @sbrajesh

    Hi Jeff,
    There are many ways to do it.
    here is one way.
    You can put the following code in your bp-custom.php

    `
    add_filter(‘bp_groups_default_extension’,’my_custom_group_default_tab’);
    function my_custom_group_default_tab($default_tab){

    $group=groups_get_current_group();//get the current group

    if(empty($group))
    return $default_tab;

    //otherwise, you may create a switch/if else to default to some other tab based on group slug of id what ever you prefer
    //here I am testing agains slug
    switch($group->slug){

    case ‘awesome-group’:
    $default_tab=’forum’;
    break;

    case ‘study-group’:
    $default_tab=’members’;
    break;

    default:

    $default_tab=’home’;//
    break;

    }

    return $default_tab;
    }
    `

    You can modify it for anything you want. Hope that helps.


    jeffacubed
    Participant

    @jeffacubed

    Hi Brajesh,

    Well, thank you so much! That little piece of ‘magic-code’ accomplishes exactly what I was hoping to do in controlling the default landing-tab for individual groups. A very welcome addition to my bp-custom.php file.

    “Give the world the best you have, and the best will come to you.” Indeed √

    Your piece of code becomes a key control lever in my latest buddypress open-innovation + collaboration project – thanks again!

    -Jeff (Arsenault)
    Vancouver, Canada


    Brajesh Singh
    Participant

    @sbrajesh

    Hi Jeff,
    Thank you for the kind word.
    You are most welcome.
    I am glad I could help 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Control default 'landing' tab on a group-by-group basis’ is closed to new replies.
Skip to toolbar