Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to I add something to “item-nav” on Profile Page?

  • @gregfielding

    Participant

    What code do I need to add to my plugin so it registers there? (with Profile, Followers, Friends, Groups, etc.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • @crashutah

    Participant

    Are you talking about adding it to the nav? Here’s some code I use (which I think I took from Boone’s plugin):

    function process_donations_setup_profile_nav() {
    global $bp;

    /* Add ‘Donations’ tab to the main user profile navigation */
    bp_core_new_nav_item( array(
    ‘name’ => __( ‘Donations’, ‘buddypress’ ),
    ‘slug’ => $bp->process_donations->slug,
    ‘position’ => 25,
    ‘screen_function’ => ‘process_donations_donations_collected’,
    ‘default_subnav_slug’ => ‘donations-collected’,
    ‘show_for_displayed_user’ => process_donations_access_test()
    ) );

    $process_donations_link = $bp->loggedin_user->domain . $bp->process_donations->slug . ‘/’;

    /* Create two sub nav items for this component */
    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Donations Collected’, ‘bp-invite-anyone’ ),
    ‘slug’ => ‘donations-collected’,
    ‘parent_slug’ => $bp->process_donations->slug,
    ‘parent_url’ => $process_donations_link,
    ‘screen_function’ => ‘process_donations_donations_collected’,
    ‘position’ => 10,
    ‘user_has_access’ => process_donations_access_test()
    ) );

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Donations Made’, ‘bp-invite-anyone’ ),
    ‘slug’ => ‘donations-made’,
    ‘parent_slug’ => $bp->process_donations->slug,
    ‘parent_url’ => $process_donations_link,
    ‘screen_function’ => ‘process_donations_donations_made’,
    ‘position’ => 20,
    ‘user_has_access’ => process_donations_access_test()
    ) );
    }

    add_action( ‘wp’, ‘process_donations_setup_profile_nav’, 2 );
    add_action( ‘admin_menu’, ‘process_donations_setup_profile_nav’, 2 );

    @gregfielding

    Participant

    Thanks @techguy.

    I’m trying to add a “my topics” for forums. You’ve given me a place to start!

    @crashutah

    Participant

    You should be able to use the subnav code above to add a “My Topics” subnav to the Forums tab. I’ve done it with one of the other existing tabs. You just have to find the bp_core_new_nav_item() call that adds the forums tab. Then, use some of the code above as a model to add a subnav I think.

    The other key is that the ’screen_function’ is the name of the function that will be called when that Nav is clicked.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to I add something to “item-nav” on Profile Page?’ is closed to new replies.
Skip to toolbar