BB Press Favourite Tab
-
Hello,
I installed both WP Favorite Posts and BuddPress. And i would like to show favorite posts of the user in buddypress tab.
I created a tab using this code;
function my_test_setup_nav() { global $bp; $parent_slug = 'test'; $child_slug = 'test_sub'; //name, slug, screen, position, default subnav bp_core_new_nav_item( array( 'name' => __( 'test' ), 'slug' => $parent_slug, 'screen_function' => 'my_profile_page_function_to_show_screen', 'position' => 40, 'default_subnav_slug' => 'test_sub' ) ); /* Add the subnav items to the profile */ // name, slug, parent_url, parent slug, screen function bp_core_new_subnav_item( array( 'name' => __( 'Home' ), 'slug' => $child_slug, 'parent_url' => $bp->loggedin_user->domain . 'test/', 'parent_slug' => $parent_slug, 'screen_function' => 'my_profile_page_function_to_show_screen' ) ); bp_core_new_subnav_item( array( 'name' => __( 'Random Stuff' ), 'slug' => 'random', 'parent_url' => $bp->loggedin_user->domain . 'test/', 'parent_slug' => $parent_slug, 'screen_function' => 'my_profile_page_function_to_show_screen234' ) ); function my_profile_page_function_to_show_screen() { //add title and content here - last is to call the members plugin.php template add_action( 'bp_template_title', 'my_profile_page_function_to_show_screen_title' ); add_action( 'bp_template_content', 'my_profile_page_function_to_show_screen_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function my_profile_page_function_to_show_screen_title() { echo 'something'; } function my_profile_page_function_to_show_screen_content() { $favorite_post_ids = wpfp_get_users_favorites($GLOBALS['bp']->displayed_user->userdata->user_login); } //random page content: function my_profile_page_function_to_show_screen234() { //add content here - last is to call the members plugin.php template add_action( 'bp_template_content', 'my_profile_page_function_to_show_screen234_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function my_profile_page_function_to_show_screen234_content() { echo 'This is a random page.'; } } add_action( 'bp_setup_nav', 'my_test_setup_nav' );
But i could not load WPFP on this tab. There is a snippet which is a screen function:
$fav_array = wpfp_get_users_favorites(bp_get_member_user_id());
But i don’t know where to put. And also, if there is anything to change in the code.
Thank you in advance.
- The topic ‘BB Press Favourite Tab’ is closed to new replies.