Skip to:
Content
Pages
Categories
Search
Top
Bottom

regarding bp_core_new_nav_item.

  • Avatar of yadigit
    yadigit
    Participant

    @yadigit

    Hi guys. I’ve asked this question before, but in a different way.

    When adding a new tab to the profile you would use this code.

    bp_core_new_nav_item( array(
      'name' => 'Document List',
      'slug' => 'group-document-list',
      'parent_url' => $bp->loggedin_user->domain . $bp->groups->slug . '/',
      'parent_slug' => $bp->groups->slug,
      'screen_function' => 'group_document_list_function_to_show_screen',
      'position' => 55
    ) );
    function group_document_list_function_to_show_screen() {
       //add title and content here - last is to call the members plugin.php template
       add_action( 'bp_template_title', 'group_document_list_function_to_show_screen_title' );
       add_action( 'bp_template_content', 'group_document_list_function_to_show_screen_content' );
       bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function group_document_list_function_to_show_screen_title() {
        echo 'Documents for this group';
    }
    function group_document_list_function_to_show_screen_content() {
       display_group_document_list();
    }
    

    everything works out fine.. Now.. what I want to do with this code is instead of having the template load though bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' )
    I would like to use my own template.
    Eg (MYPLUGIN_PLUGIN_DIR .'\includes\screens\screenone-template.php');)

    It works.. for the most part, but at the bottom of the page I get a Page not found.. :(

Viewing 1 replies (of 1 total)
  • Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    missing something from bp_core_new_nav_item

    function my_add_doc_nav() {
    	global $bp;
    		
    	bp_core_new_nav_item( array(
    		'name' => 'Document List',
    		'slug' => 'group-document-list',
    		'position' => 80,
    		'screen_function' => 'group_document_list_function_to_show_screen',
    		'default_subnav_slug' => 'group-document-list',
    		'show_for_displayed_user' => true
    	) );
    }
    add_action('bp_setup_nav', 'my_add_doc_nav');
    
    function group_document_list_function_to_show_screen() {
       add_action( 'bp_template_title', 'group_document_list_function_to_show_screen_title' );
       add_action( 'bp_template_content', 'group_document_list_function_to_show_screen_content' );
       bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function group_document_list_function_to_show_screen_title() {
        echo 'Documents for this group';
    }
    
    function group_document_list_function_to_show_screen_content() {
       echo 'content';
    }
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.