[buddypress-trac] [BuddyPress Trac] #6534: A new API to manage single items navigation

buddypress-trac noreply at wordpress.org
Thu Jun 9 17:13:16 UTC 2016


#6534: A new API to manage single items navigation
------------------------------------+---------------------------
 Reporter:  imath                   |       Owner:  boonebgorges
     Type:  enhancement             |      Status:  reopened
 Priority:  high                    |   Milestone:  2.6
Component:  API - Nav               |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |
------------------------------------+---------------------------

Comment (by imath):

 @boonebgorges you're right, it's a bit confusing. Before all group nav
 items were subnavs of the group slug main nav
 https://buddypress.trac.wordpress.org/browser/tags/2.5.3/src/bp-
 groups/classes/class-bp-groups-component.php#L488

 Meaning if you did `bp_core_remove_nav_item( $group_slug )` it would
 remove the group slug nav item and all group's subnav items.

 In 2.6, we don't use yet the primary nav for the group, we just set one
 nav that is the group's slug this way even if it's a different object it
 still looks like before, all group nav items are in the secondary nav of
 the group's slug primary nav.

 So i guess the test for `bp_core_remove_nav_item( $group_slug )` is to
 check `$bp->groups->nav` is empty.

 That's probably the reason why you added this backward compat block in the
 first place.

 Now if you only need to remove a specific nav of a group (which was a
 subnav and is now a secondary nav), you use `bp_core_remove_subnav_item(
 $parent_slug, $slug, 'groups' )` where the parent slug is the group slug
 and the slug is the one of the group nav (eg: members).

 The problem @dcavins found is that you were using
 `bp_core_remove_subnav_item( $slug, $parent_slug, 'groups' );` instead. So
 a way to resolve is to change the order of parameters (eg:
 `bp_core_remove_subnav_item( $parent_slug, $slug, 'groups' )`) that's what
 did @dcavins in 6534.param-order-fix.patch or a simpler way is to set the
 $component to 'groups', that's what he did in 6534.set-component-
 instead.patch.

 For the `bp_core_remove_subnav_item` i guess the test is more to check if
 the 'members' secondary nav is the only one deleted. I'm not sure to be
 clear, am I ?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6534#comment:43>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list