[buddypress-trac] [BuddyPress Trac] #5552: bp_is_current_component_core() breaks subnav for plugins that register themselves in component array

buddypress-trac noreply at wordpress.org
Wed Apr 16 20:25:03 UTC 2014


#5552: bp_is_current_component_core() breaks subnav for plugins that register
themselves in component array
--------------------------+-----------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  high          |  Milestone:  2.1
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------
 There's a check in the /members/single/plugins.php template
 https://buddypress.trac.wordpress.org/browser/tags/2.0/bp-templates/bp-
 legacy/buddypress/members/single/plugins.php#L13 that checks
 `bp_is_current_component_core()` before outputting the subnav (via
 `bp_get_options_nav()`). Introduced in r6783 (see #4772), this was
 intended to prevent duplicate navigation from showing up when subnavs were
 added to core items (like when a plugin adds a subnav item to Settings).
 But it appears to have had the side effect of hiding the subnav of *non-
 core* items.

 So, for instance, take a plugin like Invite Anyone or BuddyPress Docs.
 They both add top-level nav items, and then add subnav items under them.
 In both cases, the subnav items do not show when using theme
 compatibility.

 I think there are some semantic issues at play here.
 `bp_is_current_component_core()` doesn't actually check to see whether a
 component is a core component. It checks to see whether `bp_is_active(
 $component )` is true. But this is true for any component that's bothered
 to register itself in the active_components array, which is any plugin
 that's "doing it right".

 I don't have any definitive ideas about how to fix this. One brute force
 method is to remove the problematic check, and then to put a flag in
 `bp_get_options_nav()` that prevents it from firing twice on a single
 page. Another is to put a filter on `bp_is_current_component_core()` so
 that, at the very least, plugins can manually short-circuit the check when
 they know that they need the nav. Neither of these seem very elegant, so
 ideas welcome.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5552>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list