-
Author
-
May 2, 2014 at 14:38 #16670erannouParticipant
Hello everyone,
I tried to add a custom tabs after the usual profile tabs, like this:
ACTIVITY
PROFILE
NOTIFICATIONS
MESSAGES
FRIENDS
GROUPS
FORUMS
MEDIA
SETTINGS
CUSTOM TABI succesffully added it by following some tutorial with the bp_core_new_nav_item functions. The problem is to display a specific page when I click on it.
On most of the other themes, we just add this kind of functions:
COPY CODEadd_action( ‘bp_template_content’, ‘my_profile_page_show’ ); bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘members/single/plugins’ ) );
The problem with Kleo is the fact that I can’t use plugins as the template as there is no header nor footer inside. So I search which was the Buddypress template, I found the Buddypress.php who seems to be the template, but instead of a hook to replace the content, there is the function: “the_content()”, and I don’t know how to use it.
So how can I make this things work ????
Here is my code, I put that in my child theme functions.php:
COPY CODEfunction my_setup_nav() { global $bp; bp_core_new_nav_item( array( 'name' => __( 'my profile', 'buddypress' ), 'slug' => 'my-profile', 'position' => 100, 'screen_function' => 'my_profile_page', ) ); } add_action( 'bp_setup_nav', 'my_setup_nav' ); function my_profile_page() { add_action( ‘bp_template_content’, ‘my_profile_page_show’ ); bp_core_load_template( 'members/single/plugins' ); } function my_profile_page_show() { bp_core_load_template( 'members/single/my_template' ); }
May 8, 2014 at 16:12 #17188AbeKeymasterHi, this code work for me to add a custom tab:
COPY CODE//Buddypress add profile tab add_action( 'bp_setup_nav', 'my_test_setup_nav' ); 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 tab', 'slug' => $parent_slug, 'screen_function' => 'my_profile_page_function_to_show_screen', 'position' => 40, 'default_subnav_slug' => $child_slug ) ); } 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 'Page title'; } function my_profile_page_function_to_show_screen_content() { echo 'Page content'; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The topic ‘Additional BuddyPress custom profile tabs’ is closed to new replies.