[wp-trac] [WordPress Trac] #16714: Introduce capabilities for adding new posts
WordPress Trac
wp-trac at lists.automattic.com
Mon Apr 18 13:52:29 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: needs-patch |
-----------------------------+-----------------------
Comment (by kevinB):
Is the post creation capability to be governed independent of post
editing? If so, the admin menu for each post type will need to be
displayed if the user has edit_posts OR create_posts. But the current API
only supports one required cap per menu:
{{{
$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-
js menu-top menu-icon-post', 'menu-posts', 'div' );
}}}
{{{
$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page',
'', 'menu-top menu-icon-page', 'menu-pages', 'div' );
}}}
{{{
$menu[$ptype_menu_position] = array( esc_attr(
$ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts,
"edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class,
'menu-posts-' . $ptype_for_id, $menu_icon );
}}}
{{{
foreach ( $menu as $id => $data ) {
if ( ! current_user_can($data[1]) )
$_wp_menu_nopriv[$data[2]] = true;
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16714#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list