Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem with bp_core_new_subnav_item under Sites


  • Lemmy
    Participant

    @lemmyc

    Hi,
    I’m trying to make a subnav item under Sites, so that I can add a ‘Create New Site’ menu entry.
    It doesn’t work because $bp->current_action is not set, so the creation fails at this line in bp-core-buddybar.php:

    	// If we *do* meet condition (2), then the added subnav item is currently being requested
    	if ( ( bp_current_action() && bp_is_current_action( $slug ) ) || ( bp_is_user() && ! bp_current_action() && ( $screen_function == $bp->bp_nav[$parent_slug]['screen_function'] ) ) ) {

    It works if I put the submenu under Groups however.

    Here’s the function in my plugin class:

        public function bp_setup_nav(){
        	global $bp;
        	$blogsslug = $bp->blogs->slug; 	
        	$blogs_link = $bp->loggedin_user->domain . $blogsslug . '/';
        	bp_core_new_subnav_item( array(
        			'name' => __('Create New Site'),
        			'slug' => 'create-new-site',
        			'parent_slug' => $blogsslug,
        			'parent_url' => $blogs_link,
        			'screen_function' => array(&$this, 'create_new_site_page_template'),
        			'position' => 20,
        			'user_has_access' => true
        	) );
        }

    If I set $blogsslug = $bp->groups->slug;
    then the submenu appears successfully under Groups.

    Any ideas what the problem is?

Viewing 1 replies (of 1 total)

  • Lemmy
    Participant

    @lemmyc

    Wellll… after much debugging. I had to override members->single->blogs.php in my child theme and set the subnav to have a no-ajax class.
    ie. <div class="item-list-tabs no-ajax" id="subnav" role="navigation">

    I don’t know if I lose anything with the My Sites page if no-ajax is set.

    It would really be much nicer if I could just achieve this in the plugin without messing with the theme. Or have I done something wrong here?

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with bp_core_new_subnav_item under Sites’ is closed to new replies.
Skip to toolbar