Hi,
I’m not sure if it can help you but the following may resolve your problem :
function my_bp_nav_adder()
{
bp_core_new_nav_item(
array(
'name' => __('New Tab Button', 'buddypress'),
'slug' => 'all-conversations',
'position' => 75,
'show_for_displayed_user' => true,
'screen_function' => 'all_conversations_link',
'item_css_id' => 'all-conversations'
));
print_r($wp_filter);
}
function all_conversations_link () {
//add title and content here - last is to call the members plugin.php template
add_action( 'bp_template_title', 'my_groups_page_function_to_show_screen_title' );
add_action( 'bp_template_content', 'my_groups_page_function_to_show_screen_content' );
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function my_groups_page_function_to_show_screen_title() {
echo 'My new Page Title';
}
function my_groups_page_function_to_show_screen_content() {
echo 'My Tab content here';
}
add_action( 'bp_setup_nav', 'my_bp_nav_adder' );
source: http://codex.themedelta.com/how-to-create-a-new-tab-in-buddypress-member-page/
You have to change “members/single/plugins” by the path to your new template file without the .php extention.
If you need to check if the action already existe for different purpose (I already need to do something similar) you can use something like this:
if(has_action('name_of_action_to_check_for')) {
// action exists so execute it
do_action('name_of_action_to_check_for');
} else {
// action has not been registered
}
Hope this help 😉
Hi briKou,
thank you – although I think that example is meant for versions earlier than 1.7? nevertheless I’ll give it a try. I was looking for something to use inside a class like in the example in the codex, but I haven’t fully understood it