[wp-trac] [WordPress Trac] #29213: Introduce capability for access to nav-menus.php

WordPress Trac noreply at wordpress.org
Fri Jan 16 06:23:43 UTC 2015


#29213: Introduce capability for access to nav-menus.php
------------------------------------------------+--------------------------
 Reporter:  westonruter                         |       Owner:  ocean90
     Type:  enhancement                         |      Status:  reviewing
 Priority:  normal                              |   Milestone:  4.2
Component:  Menus                               |     Version:  3.0
 Severity:  normal                              |  Resolution:
 Keywords:  has-patch dev-feedback 2nd-opinion  |     Focuses:
                                                |  administration
------------------------------------------------+--------------------------
Changes (by westonruter):

 * keywords:  has-patch dev-feedback => has-patch dev-feedback 2nd-opinion


Comment:

 This change is causing a problem:

 > Bubble-up submenu admin page capability in addition to location; replace
 label if no children left. This is based on the great research by jesin.
 If the user lacks the capability for the original menu parent, then the
 capability and location of the first sub-menu item is assigned to the
 parent. If there is only one submenu item anyway, then the label is also
 copied up to the parent item.

 The legacy "Link Categories" menu to appear as a top-level admin menu item
 when the current user can `manage_categories` but cannot `manage_links`.
 In the beautiful `wp-admin/menus.php` we have:

 {{{#!php
 <?php
 // ...
 $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '',
 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
         $submenu['link-manager.php'][5] = array( _x('All Links', 'admin
 menu'), 'manage_links', 'link-manager.php' );
         /* translators: add new links */
         $submenu['link-manager.php'][10] = array( _x('Add New', 'link'),
 'manage_links', 'link-add.php' );
         $submenu['link-manager.php'][15] = array( __('Link Categories'),
 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
 }}}

 As described above, the behavior is to move a submenu item to the parent
 if there is only one submenu item. In this case, the parent item was also
 inaccessible. The quick fix here could be to wrap this entire block in a
 `if ( get_option( 'link_manager_enabled' ) )` check. However, I'm afraid
 that there could be other instances where submenu items inadvertently
 bubble up to the top admin menu, due to the brittleness of `wp-
 admin/menus.php`.

 For the admin menu, at least, we may need to go the route of the
 `customize` cap and just require that plugins manually add admin menu
 items for the managing menus.

 The links in the admin bar, however, could be a different story since it
 is not brittle.

 Thoughts?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29213#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list