[buddypress-trac] [BuddyPress] #4837: Leaving out the default_subnav_slug param in bp_core_new_nav_item() breaks the new tab display (was: using bp_core_new_nav_item and plugins.php borked)

buddypress-trac noreply at wordpress.org
Wed Feb 20 00:17:58 UTC 2013


#4837: Leaving out the default_subnav_slug param in bp_core_new_nav_item() breaks
the new tab display
-------------------------+-----------------------------
 Reporter:  modemlooper  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  low          |   Milestone:  Future Release
Component:  Core         |     Version:  1.7
 Severity:  minor        |  Resolution:
 Keywords:               |
-------------------------+-----------------------------
Changes (by boonebgorges):

 * severity:  blocker => minor
 * priority:  highest => low
 * milestone:  1.7 => Future Release
 * type:  defect (bug) => enhancement


Old description:

> plugins.php needs a face punch!
>
> adding a nav item to user nav with bp_core_new_nav_item adds the item but
> when you visit the url it shows the members list displaying the users
> friends. It's not showing the profile header but the members directory.

New description:

 plugins.php needs a face punch!

 adding a nav item to user nav with bp_core_new_nav_item adds the item but
 when you visit the url it shows the members list displaying the users
 friends. It's not showing the profile header but the members directory.

 [Edit - see comment:3 below for more explanation of what's happening]

--

Comment:

 OK, thanks for the additional information.

 I've done some investigation, and it turns out that this is not actually
 related to theme compat at all (or plugins.php for that matter). The
 problem is that the sample plugin is not using the `'default_subnav_slug'`
 parameter when registering the nav item with `bp_core_new_nav_item()`. If
 you do this, it works:

 {{{
 bp_core_new_nav_item( array(
                 'name' => __( 'SubNav', 'bp-subnavy' ),
                 'slug' => 'subnav',
                 'screen_function' => 'bp_subnav_screen_settings_menu',
                 'default_subnav_slug' => 'subnav',
                 'position' => 40,
                 'user_has_access' => bp_is_my_profile()
         ) );
 }}}

 This is kind of a quirk in the way that `bp_core_new_nav_item()` works.
 (See http://buddypress.trac.wordpress.org/browser/tags/1.6.4/bp-core/bp-
 core-buddybar.php#L87 to see why.) In the future, it would be nice to
 refactor this function a bit so that this requirement is not in place -
 there are other reasons to want to refactor this function anyway.

 For now, this is not a regression, and it can easily be avoided by using
 the `default_subnav_slug` item. I'll update the ticket title
 appropriately. Could you please pass this along back the OP on the forums?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4837#comment:3>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list