[buddypress-trac] [BuddyPress] #4431: BuddyPress Default Theme is Incompatible with WP 3.4 "Menus" Functionality (was: BuddyPress Default Theme Incorrectly Nests Child Pages in Primary Navigation Menu)

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Mon Aug 13 13:54:03 UTC 2012


#4431: BuddyPress Default Theme is Incompatible with WP 3.4 "Menus" Functionality
--------------------------+------------------------------
 Reporter:  foxly         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Theme         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by foxly):

 * severity:  major => normal


Comment:

 Update:

 BP's template code appears to be working correctly. WP is feeding
 incorrect nav menu HTML to the template header.

 The defect can be triggered at will by:

 1) Creating two nested menu pages
 2) Setting the active template to "Buddypress Default"
 3) Navigating to Appearance->Menus and setting "Primary Navigation" to
 "Main"

 The defect can be reversed by setting "Primary Navigation" back to the
 blank option in the drop-down box.

 Although far less severe than a broken parent template, this defect is
 more-or-less guaranteed to cause vexing support issues because:

 1) The "Menus" screen implies that the user is supposed to set a primary
 navigation menu.
 2) Taking that action breaks the user's site
 3) The action that breaks the site appears unrelated to the problem it
 causes - it took almost two hours of back-tracing through the WP core to
 discover the root cause of this problem.

 ==========

 Technical Details:

 1) Setting "primary navigation menu" causes table: wp_options key:
 "theme_mods_bp-default" to be set containing the key
 ["nav_menu_locations"][0]["primary"]

 2) During the header build process in template file "header.php" at line
 42, function wp_nav_menu() is called. It calls the following chain of
 functions:

 ->get_nav_menu_locations()
 ->get_theme_mod('nav_menu_locations')
 ->get_theme_mods()
 ->get_option('theme_mods_$theme_slug')

 If any "nav_menu_location" keys are set in the "theme_mods_bp-default"
 database key, wp_nav_menu() internally generates the navigation menu HTML
 and returns it to the template function, which is UNDESIRED behaviour.

 If the "nav_menu_locations" key is empty, wp_nav_menu() calls the
 fallback_cb function "bp_dtheme_main_nav" passed as an arg in the
 template. This calls bp_dtheme_main_nav() located at 597 in functions.php
 which generates custom HTML code with the structure necessary for a multi-
 level menu. This is the DESIRED behaviour.

 ========

 I'm going to keep playing with this one and try and find a durable
 solution.

 -F

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4431#comment:2>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list