Skip to:
Content
Pages
Categories
Search
Top
Bottom

extra tab make it public to non registered


  • pryde1919
    Participant

    @pryde1919

    I used this code to addextra tab, but it seems to be that the tab will be shown if the user is login, how can i make it public even non-register users can see it? Thankyou

    
    //add maintab 
    function profile_new_nav_item() {
    
        global $bp;
    
        bp_core_new_nav_item(
        array(
            'name'                => 'Store',
            'slug'                => 'store_tab',
            'default_subnav_slug' => 'store_tab', // We add this submenu item below 
            'screen_function'     => 'view_manage_tab_main'
        )
        );
    }
    
    add_action( 'bp_setup_nav', 'profile_new_nav_item', 10 );
    
    function view_manage_tab_main() {
        add_action( 'bp_template_content', 'bp_template_content_main_function' );
        bp_core_load_template( 'template_content' );
    }
    
    function bp_template_content_main_function() {
        if ( ! is_user_logged_in() ) {
            wp_login_form( array( 'echo' => true ) );
        }
    }
    
    //add sub tab01
    function profile_new_subnav_item() {
        global $bp;
    
        bp_core_new_subnav_item( array(
            'name'            => 'Pstore ',
            'slug'            => 'pstore_tab',
            'parent_url'      => $bp->displayed_user->domain . $bp->bp_nav[ 'store_tab' ][ 'slug' ] . '/',
            'parent_slug'     => $bp->bp_nav[ 'store_tab' ][ 'slug' ],
            'position'        => 10,
            'screen_function' => 'view_manage_sub_tab_main'
        ) );
    }
    add_action( 'bp_setup_nav', 'profile_new_subnav_item', 10 );
    
    function view_manage_sub_tab_main() {
        add_action( 'bp_template_content', 'bp_store' );
        bp_core_load_template( 'template_content' );
    }
    
    function bp_store() {
        if ( is_user_logged_in() ) {
            //Add shortcode to display content in sub tab
    		
        } else {
            wp_login_form( array( 'echo' => true ) );
        }
    }
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘extra tab make it public to non registered’ is closed to new replies.
Skip to toolbar