Skip to:
Content

BuddyPress.org

Opened 10 years ago

Last modified 16 months ago

#5722 new defect (bug)

Theme compat does not recognize single member page if no subnav item is registered

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

Consider a simple implementation of BP_Component that does not need a subnav. The logical way to do this is to register no subnav items in setup_nav():

public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    $main_nav = array(
        'name' => 'Foo',
        'slug' => 'foo',
        'screen_function' => 'foo',
    );
    parent::setup_nav( $main_nav, $sub_nav );
}

However, when setting it up this way and then visiting example.com/members/yourname/foo/, the Members directory template loads. That's because the Members component theme compat will not recognize this as a single member page, due to the fact that bp_current_action() will be empty. See https://buddypress.trac.wordpress.org/browser/tags/2.0.1/bp-members/bp-members-screens.php#L296 (line 303)

I have a feeling that what's needed is just to switch this logic around, so that the check is more like if ( bp_is_user() ) { // single } else { // directory }, but this will obviously take some testing.

Change History (1)

#1 @DJPaul
10 years ago

  • Milestone changed from Awaiting Review to Future Release

Nice catch, would be good to get this fixed at some point. I think your proposal is along the right lines but I'd need to spend time looking into this properly.

Note: See TracTickets for help on using tickets.