Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add “Posts” Tab? Very frusterated

  • Hi everyone, I thought this would be a standard feature as it seems very necessary but I cannot find any info on it anywhere!

    The main feature of my blog is to have users submit their own posts. How can I add a tab to the public user profile that will show all the posts they have authored? Similar to what happens when click on the authors name on their post, it takes you to an archive of every post that author has written. I really need this feature and any help is appreciate! Thanks!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • No one knows?

    I was looking EVERYWHERE for the same thing and nobody would answer my questions. I finally found out how to accomplish adding a tab to the nav bar.

    Paste this code into your bp-custom.php file located in your “plugin” directory:

    function my_test_setup_nav() {
    global $bp;
    bp_core_new_nav_item( array( ‘name’ => __( ‘test’ ), ‘slug’ => ‘test’, ‘parent_url’ => $bp->loggedin_user->domain . $bp->slug . ‘/’, ‘parent_slug’ => $bp->slug, ‘screen_function’ => ‘my_profile_page_function_to_show_screen’, ‘position’ => 40 ) );

    bp_core_new_subnav_item( array( ‘name’ => __( ‘Home’ ), ‘slug’ => ‘test_sub’, ‘parent_url’ => $bp->loggedin_user->domain . $bp->slug . ‘/’, ‘parent_slug’ => $bp->slug, ‘parent_slug’ => $bp->slug, ‘screen_function’ => ‘my_profile_page_function_to_show_screen’, ‘position’ => 20, ‘item_css_id’ => ‘test_activity’ ) );

    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() {

    echo ‘weee content’;

    }
    }
    add_action( ‘bp_setup_nav’, ‘my_test_setup_nav’ );

    This will add a button into the nav bar named “test” which redirects back to the profile page. It would only take a bit more tweaking to get it to display the page you want. Hope this helps.

    @austinfav

    Thanks austin! However, it seems like everytime I try to do something with bp_custom.php (i made this file in my plugin directory) nothing changes. any idea why?


    Boone Gorges
    Keymaster

    @boonebgorges

    The file should be bp-custom.php (with a hyphen, not an underscore). Also, make sure you have opening and closing PHP delimiters:
    `<?php
    // your code here
    ?>`


    Sofian J. Anom
    Participant

    @lightcapturer

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add “Posts” Tab? Very frusterated’ is closed to new replies.
Skip to toolbar