Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Page


  • Andrew
    Participant

    @sm60

    I’m trying to create a custom page mysite.com/username/test, and I’m having the same problem someone else had who mentioned this in the support forum.

    From my understanding, the simplest way to create a custom page is to setup the nav, load the members/single/plugins.php template and hook your custom content into bp_template_content. This is the code I found for it that sets up a custom page at mysite.com/username/test

    define( 'TEST_BP_COMPONENT_SLUG', 'test' );
    
    class TEST_BuddyPress {
    
    	function TEST_BuddyPress() {
    		global $bp;
    				
    		add_action( 'bp_setup_nav', array( &$this, 'bp_setup_nav'), 100 );
    	}
    	
    	function bp_setup_nav() {
    		bp_core_new_nav_item( array(
    			'name' => __( 'Test', YOUR_TEXTDOMAIN ),
    			'slug' => TEST_BP_COMPONENT_SLUG,
    			'screen_function' => array( &$this, 'tab_template' ),
    		) );
    	}
    
    	function tab_template() {		
    		add_action( 'bp_template_content', array( &$this, 'tab_content' ) );
    		bp_core_load_template( 'members/single/plugins' );
    	}
    
    	function tab_content() {
    	     // add your content here
    	}
    }
    
    $GLOBALS['_test_buddypress'] = new TEST_BuddyPress;

    The problem with this is it is loading the members/index.php template instead of members/single/plugins.php template. How do I load up the members/single/plugins template with this code.

    I have the latest BuddyPress version network activated on a multisite. Any help appreciated.

  • The topic ‘Custom Page’ is closed to new replies.
Skip to toolbar