Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Tab and plugin integration question


  • HolgerGr
    Participant

    @holgergr

    Hi,

    I found some really useful code for adding custom tabs to Buddypress using the bp-custom.php. For all whao are interested, this is it:

    function profile_new_nav_item() {
    
        global $bp;
    
        bp_core_new_nav_item(
            array(
                'name'                => 'Anzeige',
                'slug'                => 'about',
              'default_subnav_slug' => 'extra_sub_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 ) );
        }
    }
    
    function profile_new_subnav_item() {
        global $bp;
    
        bp_core_new_subnav_item( array(
            'name'            => 'Extra Sub Tab',
            'slug'            => 'extra_sub_tab',
          //  'parent_url'      => $bp->loggedin_user->domain . $bp->bp_nav[ 'about' ][ 'slug' ] . '/',
    	    'parent_url'      => 'http://wighty.de/awpcp/place-ad/',
            'parent_slug'     => $bp->bp_nav[ 'about' ][ '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_template_content_sub_function' );
        bp_core_load_template( 'template_content' );
    }
    
    function bp_template_content_sub_function() {
        if ( is_user_logged_in() ) {
           echo 'awpcp/place-ad/';
    	  // bp_get_template_part( 'members/single/profile/profile-loop' );
    	  // bp_get_template_part( 'awpcp/place-ad/' );
        } else {
            wp_login_form( array( 'echo' => true ) );
        }
    }
    

    This code adds a custom tab plus one subtab to Buddypress and depending on the uncommented line, it shows a message or the common BP profile loop.

    Unfortunately until now I couldn’t figure out how to tell Buddypress to show the place ad form of another plugin instead of the profile loop. And this ist my question. How can I get it working? I would like to replace the loop with the place-ad form of a classified plugin.

    Does anyone know how to do?

    Thanks alot
    Holger

Viewing 1 replies (of 1 total)

  • sayram
    Participant

    @sayram

    thank you. very usefull for me.

    // bp_get_template_part( ‘members/single/profile/profile-loop’ );

    where should be its physical file? i mean what is the physical path.

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