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

WordPress Trac noreply at wordpress.org
Thu Jan 15 07:07:54 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  |     Focuses:  administration
------------------------------------+-----------------------------

Comment (by westonruter):

 By the way, here is a sample plugin which grants access to `manage_menus`
 for a user who can `edit_posts`:

 {{{#!php
 <?php
 function allow_users_who_can_edit_posts_to_customize( $caps, $cap,
 $user_id ) {
         $required_cap = 'edit_posts';
         if ( 'manage_menus' === $cap && user_can( $user_id, $required_cap
 ) ) {
                 $caps = array( $required_cap );
         }
         return $caps;
 }
 add_filter( 'map_meta_cap', 'allow_users_who_can_edit_posts_to_customize',
 10, 3 );
 }}}

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


More information about the wp-trac mailing list