/**
* Register new subnav tabs for BP 'Profile'
*
* @author Damon Cook
*/
function wds_ye_add_profile_tabs() {
global $bp;
// Define new subnav items.
$subnav_items = array(
'notes' => esc_html__( 'Notes', 'youth' ),
'events' => esc_html__( 'Events', 'youth' ),
'points' => esc_html__( 'Points', 'youth' ),
'cash' => esc_html__( 'Cash', 'youth' ),
);
// Loop through each new subnav and register.
foreach ( $subnav_items as $subnav_slug => $subnav_name ) {
bp_core_new_subnav_item( array(
'name' => $subnav_name,
'slug' => $subnav_slug,
'parent_url' => trailingslashit( bp_displayed_user_domain() . $bp->profile->slug ),
'parent_slug' => $bp->profile->slug,
'screen_function' => 'wds_ye_add_profile_' . $subnav_slug . '_tab_screen',
'position' => 80,
'user_has_access' => wd_ye_should_new_profile_subnav_items_be_displayed(),
'item_css_id' => $subnav_slug,
) );
}
}
add_action( 'bp_setup_nav', 'wds_ye_add_profile_tabs', 100 );
/**
* Callback for 'Points' tab to register title and content
*
* @author Damon Cook
* @param string $slug Slug of registered nav item.
*/
function wds_ye_add_profile_points_tab_screen( $slug ) {
add_action( 'bp_template_content', 'wds_ye_add_profile_points_tab_screen_content' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}