[wp-trac] [WordPress Trac] #8597: Submenu highlighting in ACP By URI/Query to highlight correctly for some plugins

WordPress Trac wp-trac at lists.automattic.com
Fri Dec 12 17:51:25 GMT 2008


#8597: Submenu highlighting in ACP By URI/Query to highlight correctly for some
plugins
---------------------+------------------------------------------------------
 Reporter:  ixiter   |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  normal   |   Milestone:  2.7.1    
Component:  General  |     Version:           
 Severity:  normal   |    Keywords:           
---------------------+------------------------------------------------------
 When a plugin creates an own Menu with own SubMenus in the ACP, and uses
 links with the same filename but different parameters for the SubMenu
 entries, the highlighting for the "current" page fails for these SubMenus.
 You can reproduce this bug with the statpress plugin. Submenus will not be
 highlighted. Always and only the "Overview" Submenu is highlighted!

 In wp-admin/menu-header.php the "current" status of an item is just chosen
 from plugin name and plugin filename. The filename is taken from the page
 parameter from the URI. Other parameters are ignored. This causes the bug.
 My patch compares the URI Parameters with $sub_item[2], if there is more
 than one parameter, instead of the filename only. That way also additional
 parameters with same filenames are recognized and teh SubMenus are
 highlighted correctly.

 File wp-admin/menu-header.php[[BR]]
 FIND: (Lines 97 and 98)
 {{{
 if ( !current_user_can($sub_item[1]) )
 continue;
 }}}

 INSERT AFTER:
 {{{
 $params = substr($_SERVER['QUERY_STRING'], 5); // remove the 'page='
 }}}

 FIND: (Line 110)
 {{{
 } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] &&
 (!file_exists($item[2]) || ($item[2] == $self))) || (!isset($plugin_page)
 && $self == $sub_item[2]) ) {
 }}}

 REPLACE WITH:
 {{{
 } else if ( (isset($plugin_page) && ($params == '' && $plugin_page ==
 $sub_item[2] || $params != '' && $params == $sub_item[2]) &&
 (!file_exists($item[2]) || ($item[2] == $self))) || (!isset($plugin_page)
 && $self == $sub_item[2]) ){
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8597>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list