$title, 'slug' => 'affiliates', 'parent_url' => trailingslashit( bp_displayed_user_domain() . $bp->profile->slug ), 'parent_slug' => $bp->profile->slug, 'screen_function' => array( __CLASS__, 'add_tab_screen' ), 'position' => intval( apply_filters( 'affiliates_buddypress_nav_item_position', get_option( 'affiliates-buddypress-page-position', self::NAV_ITEM_POSITION ) ) ), 'user_has_access' => bp_is_my_profile(), 'default_subnav_slug' => 'affiliates' ) ); } } /** * Hooks on BP template actions and loads core template. */ public static function add_tab_screen() { add_action( 'bp_template_title', array( __CLASS__, 'bp_template_title' ) ); add_action( 'bp_template_content', array( __CLASS__, 'bp_template_content' ) ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } /** * Prints the Affiliate Area's template title. */ public static function bp_template_title() { $page_id = get_option( 'affiliates-buddypress-page', null ); if ( $page_id ) { echo get_the_title( $page_id ); } } /** * Prints the contents of the affiliate area page. */ public static function bp_template_content() { $page_id = get_option( 'affiliates-buddypress-page', null ); if ( $page_id ) { wp_enqueue_style( 'affiliates-buddypress' ); $post = get_post( $page_id ); echo $post->post_content; } } } Affiliates_BuddyPress::init();