Skip to:
Content

BuddyPress.org

Opened 5 years ago

Last modified 4 years ago

#7308 new defect (bug)

Make function "bp_core_menu_highlight_parent_page" multisite-aware

Reported by: martinutopia Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version: 2.7
Component: Core Keywords: good-first-bug needs-patch
Cc:

Description

In my WP-multisite I want to loop over posts in a WP-Menu of my main site that is no buddypress-Site. So I'm using switch_to_blog() to get the data from my main site.

I get an error in the file buddypress/bp-core/bp-core-filters.php on line 199 that the second parameter of in_array is not an array. (it's null because the get_post() on line 198 returns null)

My suggested fix is to test if we are in a switch_to_blogs context. For that I suggest following fix on line 171 (add a check of ms_is_switched()):

if ( ! is_buddypress() || ms_is_switched() ) 


Thanks,
Martin

Change History (2)

#1 @DJPaul
5 years ago

  • Keywords good-first-bug needs-patch added
  • Milestone changed from Awaiting Review to 2.8

Hi @martinutopia

Thanks for the bug report (your first, I think; welcome!).

I think we'll fix this with our bp_is_root_blog function rather than ms_is_switched (the latter function is only present if multisite is enabled). Alternately, BuddyPress could do its own switch_to_blog inside the function. I need to spend more than 5 minutes considering the best fix to be sure, but we can definitely get this in for our next major release (2.8; early next year).

For now, I'd suggest you hook a function to that action with a higher priority, and inside that function callback, unhook the BuddyPress function from that action if ms_is_switched since that apparently works well for you.

#2 @DJPaul
4 years ago

  • Milestone changed from 2.8 to Future Release
Note: See TracTickets for help on using tickets.