[buddypress-trac] [BuddyPress Trac] #6559: nav implode() error when using BUDDYPRESS_LATE_LOAD
buddypress-trac
noreply at wordpress.org
Fri Jul 17 02:35:31 UTC 2015
#6559: nav implode() error when using BUDDYPRESS_LATE_LOAD
------------------------------+-----------------------------
Reporter: useStrict | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Component - Core | Version:
Severity: normal | Keywords:
------------------------------+-----------------------------
While debugging a conflict between Membermouse and Buddypress (Buddypress
wrongly allows a logged-out visitor to see the Members page), I found that
letting Membermouse load first with BUDDYPRESS_LATE_LOAD set to true would
fix the problem. However, a side-effect is that I then get the following
warning for several menu items:
{{{
Warning: implode(): Invalid arguments passed in
/home/makest/public_html/staging/wp-content/plugins/buddypress/bp-core/bp-
core-filters.php on line 853
}}}
The menu items in question have _invalid set to true, and therefore have
an empty class property (instead of the expected array). I could not
figure out why this does not happen without the late load.
The change below seems to resolve the problem:
{{{
46 function bp_setup_nav_menu_item( $menu_item ) {
847 if ( is_admin() ) {
848 return $menu_item;
849 }
850
851 // We use information stored in the CSS class to determine
what kind of
852 // menu item this is, and how it should be treated
853
854 if ( true === $menu_item->_invalid ) return $menu_item; //
THIS CHANGE RESOLVED THE PROBLEM
855
856 preg_match( '/\sbp-(.*)-nav/', implode( ' ',
$menu_item->classes), $matches );
}}}
Please advise if there is a better fix, or consider applying this to the
core.
Thanks!
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6559>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list