Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom page in buddy press


  • asimzaka
    Participant

    @asimzaka

    i have created a custom page in buddy press.
    First i created bp-custom.php file and added nav item and sub nav item in it. After it created a screen content function like this:

    function bp_custom_user_nav_item() {
        global $bp;
    
        $args = array(
            'name'                    => __( 'Gallery', 'buddypress' ),
            'slug'                    => 'gallery',
            'default_subnav_slug'     => 'gallery',
            'position'                => 100,
            'show_for_displayed_user' => false,
            'screen_function'         => 'bp_custom_user_nav_item_screen',
            'item_css_id'             => 'gallery-id'
        );
    
        bp_core_new_nav_item( $args );
    }
    
    add_action( 'bp_setup_nav', 'bp_custom_user_nav_item', 99 );
    
    function bp_custom_gallery_sub_nav() {
        global $bp;
        $parent_slug = 'gallery';
    
        //Add subnav item    
        bp_core_new_subnav_item( array(
                                     'name'            => __( 'Gallery' ),
                                     'slug'            => $parent_slug,
                                     'parent_url'      => $bp->loggedin_user->domain . $parent_slug . '/',
                                     'parent_slug'     => $parent_slug,
                                     'screen_function' => 'bp_custom_user_nav_item_screen',
                                     'position'        => 10,
                                     'link'            => $bp->loggedin_user->domain . $parent_slug . '/',
                                     item_css_id       => 'galley-main'
                                 ) );
    }
    
    add_action( 'bp_setup_nav', 'bp_custom_gallery_sub_nav' );
    
    function bp_custom_user_nav_item_screen() {
        add_action( 'bp_template_content', 'bp_custom_screen_content' );
        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function bp_custom_screen_content() {
        echo "My content";
    }

    When user loged in user can view this page.
    I want to check page of other user. Like you can visit profile page of other user. It shows page not found.
    How can i all members can see each others page.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar