Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using BP_DEFAULT_COMPONENT with a subnav item


  • pixieblitz
    Participant

    @pixieblitz

    Hello,
    I’m trying to select a component from the activity subnav menu (the “following” tab from a plugin) to show up as the landing page… However I can’t seem to figure out how to.

    Using define(‘BP_DEFAULT_COMPONENT’,’_____’); in bp-custom.php works for items in the top navigation, but not for subnav items. I’ve tried writing it out as define(‘BP_DEFAULT_COMPONENT’,’activity/following’) but that doesn’t work… It’s not plugin related since I can’t get any other subnav item to show up as the default, but all the top-level ones work fine. I’m probably just doing this wrong, but I’ve tried a few variations with no success.

    Any suggestions?
    (PS – Thanks, and happy new years!)

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

  • modemlooper
    Moderator

    @modemlooper

    Subnav items are not parent components so it won’t work using that define.

    
    function bp_change_activity_subnav_default() {
    
    	if ( bp_is_user_activity() ) {
    	
    		$args = array(
    			'parent_slug' => 'activity',
    			'subnav_slug' => 'following'
    		);
    		
    		bp_core_new_nav_default($args);
    	
    	}
    	
    }
    add_action('bp_setup_nav', 'bp_change_activity_subnav_default', 5);   
    

    pixieblitz
    Participant

    @pixieblitz

    Worked perfectly, thank you so much!


    modemlooper
    Moderator

    @modemlooper

    updated code to only have it run on user activity as it might conflict with the main activity loop


    drvdb
    Participant

    @drvdb

    The code is working perfect, thanks for it, but I have trouble with the post-form, it does not show on the page anymore.

    When I am adding

    if ( is_user_logged_in()&&( '' == bp_current_action() || 'just-me' == bp_current_action() ) )
    locate_template( array( 'activity/post-form.php',

    ), true ) ;

    to the theme –> members/single/activity.php a nice form comes up, which I want to keep. What I also want is if you go to a member or yourself that you go directly to the mentions page. This is working with the code above. But together only your code is working and the form does not show op.

    My site is http://www.social4you.net.

    Can you please help me?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using BP_DEFAULT_COMPONENT with a subnav item’ is closed to new replies.
Skip to toolbar