Ticket #7935: 7935.04.patch
| File 7935.04.patch, 3.0 KB (added by , 8 years ago) |
|---|
-
src/bp-core/bp-core-buddybar.php
90 90 * Add a link to the main BuddyPress navigation. 91 91 * 92 92 * @since 2.4.0 93 * @since 2.6.0 Introduced the `$component` parameter. Began returning a BP_Core_Nav_Item object on success. 93 * @since 2.6.0 Introduced the `$component` parameter. Began returning a BP_Core_Nav_Item 94 * object on success. 95 * @since 3.3.0 Introduced $args['component_id'] parameter so developers can determine what 96 * component is registering the nav. 94 97 * 95 98 * @param array|string $args { 96 99 * Array describing the new nav item. 100 * @type string $component_id The component ID registering this nav item. 97 101 * @type string $name Display name for the nav item. 98 102 * @type string $slug Unique URL slug for the nav item. 99 103 * @type bool|string $item_css_id Optional. 'id' attribute for the nav item. Default: the value of `$slug`. … … 114 118 $bp = buddypress(); 115 119 116 120 $defaults = array( 121 'component_id' => '', // The component ID registering this nav item. 117 122 'name' => false, // Display name for the nav item. 118 123 'slug' => false, // URL slug for the nav item. 119 124 'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item. … … 141 146 } 142 147 143 148 $nav_item = array( 149 'component_id' => $r['component_id'], 144 150 'name' => $r['name'], 145 151 'slug' => $r['slug'], 146 152 'link' => trailingslashit( bp_loggedin_user_domain() . $r['slug'] ), … … 342 348 // No subnav item has been requested in the URL, so set a new nav default. 343 349 if ( empty( $unfiltered_action ) ) { 344 350 if ( ! bp_is_current_action( $r['subnav_slug'] ) ) { 351 /* 352 * If the screen function isn't available, attempt to find it. 353 * 354 * This is due to our conditional-loading code since v3.0.0. 355 */ 356 if ( ! is_callable( $r['screen_function'] ) && ! empty( $parent_nav->component_id ) ) { 357 $file = $bp->core->path . 'bp-' . $parent_nav->component_id . '/screens/' . $r['subnav_slug'] . '.php'; 358 // Found the file, so require it. 359 if ( file_exists( $file ) ) { 360 require_once $file; 361 } 362 } 363 345 364 if ( is_callable( $r['screen_function'] ) ) { 346 365 add_action( 'bp_screens', $r['screen_function'], 3 ); 347 366 } -
src/bp-core/classes/class-bp-component.php
498 498 499 499 // No sub nav items without a main nav item. 500 500 if ( !empty( $main_nav ) ) { 501 // Always set the component ID. 502 $main_nav['component_id'] = $this->id; 503 501 504 bp_core_new_nav_item( $main_nav, 'members' ); 502 505 503 506 // Sub nav items are not required.