Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/15/2018 08:14:01 PM (6 years ago)
Author:
boonebgorges
Message:

Nav: Dynamically load component screen file when changing nav default.

BP 3.0.0 moved most screen controllers into files that are loaded only when
viewing the component. This introduced a regression into
bp_core_new_nav_default(), since the screen_function would not be available
(ie ! is_callable()) at the time that the nav item is modified.

We resolve this by loading the component's screen functions in
bp_core_new_nav_default() when we detect that they're not present. To work
around cases where component slugs don't match the official component ID,
which corresponds to the file path, we introduce a new 'component_id' parameter
to be used when registering a new nav item.

Props imath, r-a-y.
Fixes #7935.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-component.php

    r12180 r12288  
    499499        // No sub nav items without a main nav item.
    500500        if ( !empty( $main_nav ) ) {
     501            // Always set the component ID.
     502            $main_nav['component_id'] = $this->id;
     503
    501504            bp_core_new_nav_item( $main_nav, 'members' );
    502505
Note: See TracChangeset for help on using the changeset viewer.