[wpmu-trac] [WordPress MU Trac] #814: Incorrect $parent_exists
logic in menu-header.php, messes with plugins adding pages
WordPress MU Trac
wpmu-trac at lists.automattic.com
Sat Dec 13 21:59:18 GMT 2008
#814: Incorrect $parent_exists logic in menu-header.php, messes with plugins
adding pages
-------------------------+--------------------------------------------------
Reporter: johncoswell | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: component1 | Version:
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
My plugin, ComicPress Manager, creates a new top level nav item and a
number of submenu pages. The problem is that all of the submenu nav URLs
are being treated as if the parent item is a physical page in the file
system, rather than needing to be called via admin.php?page=. On line 121
of menu-header.php is the following:
{{{ $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR .
"/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) ||
file_exists($item[2]) || ( file_exists( WPMU_PLUGIN_DIR . "/{$item[2]}" )
|| ! is_dir( WPMU_PLUGIN_DIR . "/{$item[2]}" ) ); }}}
The problem is the two WPMU_PLUGIN_DIR checks are being ORed together,
when they should be ANDed together just like in the WP_PLUGIN_DIR check:
{{{ $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR .
"/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) ||
file_exists($item[2]) || ( file_exists( WPMU_PLUGIN_DIR . "/{$item[2]}" )
&& ! is_dir( WPMU_PLUGIN_DIR . "/{$item[2]}" ) ); }}}
This makes the menu be rendered so that the URLs of subpages that are
attached by plugins and are built to use admin.php?page= work correctly.
--
Ticket URL: <http://trac.mu.wordpress.org/ticket/814>
WordPress MU Trac <http://mu.wordpress.org/>
WordPress Multiuser
More information about the wpmu-trac
mailing list