Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_core_new_subnav_item won’t create item under Profile section?


  • Sameera
    Member

    @sameeraperera

    Hi,
    I’m trying to add an admin-only sub tab under the profile section of users. Here’s my code:
    `
    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘Test’, ‘buddypress’ ),
    ‘slug’ => ‘test’,
    ‘parent_url’ => trailingslashit( bp_displayed_user_domain() . $bp->profile->slug ),
    ‘parent_slug’ => $bp->profile->slug,
    ‘screen_function’ => ‘test_something’,
    ‘position’ => 40,
    ‘user_has_access’ => current_user_can(‘edit_users’),
    ‘site_admin_only’ => true,
    ‘item_css_id’ => $bp->profile->id
    ) );
    `

    I know I’m doing this mostly right, because I can get the tab on my own (admin) profile page. However, I can’t see the tab on anybody else’s. If I change the slug to settings, I will see the tab on any of the users as expected.
    Therefore, this looks like this behavior is specific to Profile section.

    In bp-members-loader.php : Line 137, I see the following code that cancels the sub nav creation for anybody other than the current user.

    `
    if ( !is_user_logged_in() && !bp_is_user() )
    return;
    `

    Is this the reason why adding sub menu doesn’t work? Is there a way around this?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘bp_core_new_subnav_item won’t create item under Profile section?’ is closed to new replies.
Skip to toolbar