Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Create a New Tab on Member Page

  • I have done a lot of searching and have tried all sorts of things to no avail.

    I would like to add a nav item/tab to the member profile page that displays the All Groups loop (example: http://buddypress.org/community/groups/). I can get the tab to appear, but it redirects back to the home page. My code is below. Can anyone help?

    
    bp_core_new_nav_item(
    array(
    'name' => __('All Conversations Button', 'buddypress'),
    'slug' => 'all-conversations',
    'position' => 75,
    'show_for_displayed_user' => true,
    'screen_function' => 'all_conversations_link',
    'default_subnav_slug' => 'testing',
    'item_css_id' => 'all-conversations'
    ));
    function all_conversations_link () {
    echo 'my loop will go here';
    }
    add_action( 'bp_setup_nav', 'bp_core_new_nav_item' );
    

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • By the way, I am running WP 3.1.2 with BuddyPress 1.2.8.

    I created a wrapper function, which seems to be a better way to go, but the problem persists. When I click the “All Conversations Button” link, I am redirected to the home page.

    
    function my_bp_nav_adder()
    {
    bp_core_new_nav_item(
    array(
    'name' => __('All Conversations Button', 'buddypress'),
    'slug' => 'all-conversations',
    'position' => 75,
    'show_for_displayed_user' => true,
    'screen_function' => 'all_conversations_link',
    'item_css_id' => 'all-conversations'
    ));
    }
    function all_conversations_link () {
    echo 'my loop will go here';
    }
    add_action( 'bp_setup_nav', 'my_bp_nav_adder' );
    

    Any ideas?

    Thanks!

    The latest function (above) brings me to the correct url (not to the home page), and it echoes the all_conversations_link() function before the html “doctype” declaration on the resulting page.

    How do I get the all_conversations_link() function to echo on the tab that the bp_core_new_nav_item() function creates?

    Thanks!

    The following function seems to work:

    
    function my_bp_nav_adder()
    {
    bp_core_new_nav_item(
    array(
    'name' => __('All Conversations Button', 'buddypress'),
    'slug' => 'all-conversations',
    'position' => 75,
    'show_for_displayed_user' => true,
    'screen_function' => 'all_conversations_link',
    'item_css_id' => 'all-conversations'
    ));
    }
    function all_conversations_link () {
    //add title and content here - last is to call the members plugin.php template
    add_action( 'bp_template_title', 'my_all_conversations_title' );
    add_action( 'bp_template_content', 'my_all_conversations_content' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    
    function my_all_conversations_title() {
    echo 'My Page Title';
    }
    function my_all_conversations_content() {
    echo 'Add the loop here';
    }
    add_action( 'bp_setup_nav', 'my_bp_nav_adder', 100 );
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Create a New Tab on Member Page’ is closed to new replies.
Skip to toolbar