[wp-trac] [WordPress Trac] #16714: Introduce capabilities for adding new posts

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 18 14:24:51 UTC 2011


#16714: Introduce capabilities for adding new posts
-----------------------------+-----------------------
 Reporter:  nacin            |       Owner:  casben79
     Type:  enhancement      |      Status:  accepted
 Priority:  normal           |   Milestone:  3.2
Component:  Role/Capability  |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |
-----------------------------+-----------------------

Comment (by casben79):

 @kevinb: Interesting thought, this could be useful for plugin / theme
 authors as well.

 {{{
 //Guilty untill proven innocent?
     $_wp_menu_nopriv[$data[2]] = true;
     if( is_array( $data[1] ) ){
         foreach( $data[1] as $cap ){
             if( current_user_can( $cap ) ){
                 unset( $_wp_menu_nopriv[$data[2]] );
             }
         }
     } else {
         if ( current_user_can($data[1]) )
                 unset( $_wp_menu_nopriv[$data[2]] );
     }
 }}}

 And then:

 {{{
 $menu[5] = array( __('Posts'), array( 'edit_posts' , 'create_posts' ) ,
 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts',
 'div' );
 }}}

 What do you think?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16714#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list