Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/24/2018 02:52:25 AM (8 years ago)
Author:
r-a-y
Message:

Navigation: Ensure subnav menus can be registered before the parent nav is registered.

In #7659, a bug was fixed where restricted subnav menus should be
redirected instead of throwing a 404. The side-effect of the fix is this
broke how plugins can register subnav menus before the parent nav is
created.

This commit rectifies the problem by not bailing out if the parent nav
cannot be found during subnav menu registration. Includes a unit-test.

Props dontdream, boonebgorges, r-a-y.

See #7931 (trunk).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-buddybar.php

    r11815 r12195  
    609609
    610610    $parent_nav = $bp->{$component}->nav->get_primary( array( 'slug' => $r['parent_slug'] ), false );
    611     if ( ! $parent_nav ) {
    612         return ;
    613     }
    614 
    615     $parent_nav = reset( $parent_nav );
     611    if ( is_array( $parent_nav ) ) {
     612        $parent_nav = reset( $parent_nav );
     613    }
    616614
    617615    // If we *do* meet condition (2), then the added subnav item is currently being requested.
Note: See TracChangeset for help on using the changeset viewer.