Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

#5997 closed defect (bug) (fixed)

Highlighting BP parent page in WP menu

Reported by: r-a-y Owned by: r-a-y
Milestone: 2.2 Priority: normal
Severity: normal Version: 2.1
Component: Core Keywords: commit
Cc:

Description

This is a follow-up to #5810.

The changes I recommended to bp_core_load_template() in ticket:5810#comment:3 to reinstate the BP page lookup was not the right way to highlight the page menu and created an edge-case bug (don't ask).

01.patch is the proper way to deal with highlighting the parent BP page in WP menus and also fixes problems with highlighting the parent BP page when root profiles is turned on (this never worked before).

Attachments (2)

5997.01.patch (3.8 KB) - added by r-a-y 5 years ago.
5997.02.patch (4.8 KB) - added by r-a-y 5 years ago.
02.patch adds another function to handle filtering wp_nav_menu(). The first patch only dealt with wp_page_menu().

Download all attachments as: .zip

Change History (10)

@r-a-y
5 years ago

#1 @DJPaul
5 years ago

Not tested but looks OK (but then so did the last patch on the other ticket) :)

#2 @DJPaul
5 years ago

  • Keywords has-patch needs-refresh added

Let's make the checks type-strict and get it in so we can test it.

#3 @DJPaul
5 years ago

  • Keywords needs-patch added; has-patch needs-refresh removed

#4 @r-a-y
5 years ago

Let's make the checks type-strict and get it in so we can test it.

Are you talking about lines 188 and 190 in bp-core-filters.php of 01.patch?

#5 @DJPaul
5 years ago

Yep, just being picky. :)

@r-a-y
5 years ago

02.patch adds another function to handle filtering wp_nav_menu(). The first patch only dealt with wp_page_menu().

#6 @DJPaul
5 years ago

Looks really good!

I hate to be a pedant, but (I only recently realised this) in_array has a third parameter ($strict). While not critical here, I think it will be a good habit to set it to true for reliable type comparisions going forward.

#7 @DJPaul
5 years ago

  • Keywords commit added; needs-patch removed

Let's get this in.

#8 @r-a-y
5 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 9322:

Properly highlight BuddyPress pages in a WordPress nav or page menu.

r8932 attempted to address how BuddyPress pages are highlighted in a
WordPress menu after the refactoring of bp_core_load_template() (see
r8821). r8932 resulted in declaring the BuddyPress parent page as the
current page even when it wasn't.

This commit removes this declaration and changes the highlighting method
to rely on the WP nav and page menu filters. This also fixes issues
with highlighting the BP parent page when the root profiles feature is
enabled (this previously did not work).

Fixes #5997.

Note: See TracTickets for help on using tickets.