Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change the default (or current) component without define(‘BP_DEFAULT_COMPONENT’)

  • Greetings,

    I’ve been going around and around trying some things to get this working, perhaps some of you good folks here would be able to help.

    -What I need is to conditionally set what component tab is displayed as the default. For example, if a user has filled out a certain profile field, I want to show my plugin-added tab ‘Hello’, otherwise I want to show the Profile tab when they first log-in to the site.
    -Clearly, this can’t be achieved by setting the define(‘BP_DEFAULT_COMPONENT’,’…’) statement.
    -I looked in the loading code for the core’s members module and tried to apply a method similar to the one used in the setup_globals there:

    if(some_field_set){
    $bp->default_component=’my_component’;
    }else{
    $bp->default_component=’profile’;
    }

    However, the default_component set this way gets ignored and the site always loads with the ‘Activity’ tab as current component upon login.

    Adding the $bp->current_component = $bp->default_component; line does set it to the desired tab, however, no other tab can now be selected as this one becomes an ever-current component.

    I would greatly appreciate if someone can venture a good guess on what I’m doing wrong and/or what the correct way to accomplish this is.

    Thank you in advance,
    Ann.

  • The topic ‘How to change the default (or current) component without define(‘BP_DEFAULT_COMPONENT’)’ is closed to new replies.
Skip to toolbar