I'm trying to make a custom Buddypress profile tab and make it so it is the landing page of a users profile. I have defined the tab in functions.php:
// Profile home tab
function profile_tab_overview() {
global $bp;
bp_core_new_nav_item( array(
'name' => 'Overview',
'slug' => 'overview',
'screen_function' => 'overview_screen',
'position' => 40,
'parent_url' => bp_loggedin_user_domain() . '/overview/',
'parent_slug' => $bp->profile->slug,
'default_subnav_slug' => 'overview'
) );
}
add_action( 'bp_setup_nav', 'profile_tab_overview' );
function overview_screen() {
// Add title and content here - last is to call the members plugin.php template.
add_action( 'bp_template_title', 'overview_title' );
add_action( 'bp_template_content', 'overview_content' );
bp_core_load_template( 'buddypress/members/single/plugins' );
}
function overview_title() {
echo 'Overview';
}
function overview_content() {
echo 'Content';
}
Then I set it as the profile landing page in wp-config.php with:
//Change BuddyPress default Members landing tab.
define('BP_DEFAULT_COMPONENT', 'overview' );
If i change BP_DEFAULT_COMPONENT to a standard Buddypress profile page like 'profile' it works, but it doesn't with the custom page I have created. Anyone know why, or what I can do about it?