This repository was archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
This repository was archived by the owner on Aug 16, 2024. It is now read-only.
Fatal error with custom members nav item #33
Copy link
Copy link
Closed
Labels
backward compatibilityThe issue is about broken compatibility with a theme/plugin/custom codeThe issue is about broken compatibility with a theme/plugin/custom code
Milestone
Description
I have a custom navigation item for members component. It occours a fatal error when BP-Rewrites is active. The reason of this error nav property creating just for admin requests. Is there any reason to do it?
bp-rewrites/src/bp-members/classes/class-members-component.php
Lines 100 to 103 in 91a6d6a
| // Initialize the Members Nav for WP Admin context. | |
| if ( is_admin() && ! wp_doing_ajax() ) { | |
| $this->nav = new \BP_Core_Nav(); | |
| } |
Here is my mu-plugin to see the fatal error:
<?php
namespace NefisYemekTarifleri\Custom_Nav;
add_action( 'bp_init', __NAMESPACE__ . '\\init', 999999 );
function init() {
if ( function_exists( 'bp_core_new_nav_item' ) ) {
bp_core_new_nav_item(
array(
'name' => 'Custom Nav',
'slug' => 'custom-nav',
'parent_slug' => buddypress()->members->slug,
'position' => 10,
'screen_function' => __NAMESPACE__ . '\\custom_nav_screen',
)
);
}
}
function custom_nav_screen() {
do_action( 'bp_members_screen_display_profile' );
bp_core_load_template( apply_filters( 'bp_members_screen_display_profile', 'members/single/home' ) );
}Error:
Fatal error: Uncaught Error: Call to a member function add_nav() on null
in /var/www/html/wp-content/plugins/buddypress/src/bp-core/bp-core-buddybar.php on line 172
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backward compatibilityThe issue is about broken compatibility with a theme/plugin/custom codeThe issue is about broken compatibility with a theme/plugin/custom code