If the current user does not have the delete_posts cap on the current post type, don't list delete or trash as bulk actions for the relevant context of Post list table.

Props mvd7793.
Fixes #20175.

Built from https://develop.svn.wordpress.org/trunk@29757


git-svn-id: http://core.svn.wordpress.org/trunk@29529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-09-23 02:58:16 +00:00
parent 491c91196f
commit 9768b89cc7

View File

@ -198,16 +198,21 @@ class WP_Posts_List_Table extends WP_List_Table {
protected function get_bulk_actions() {
$actions = array();
$post_type_obj = get_post_type_object( $this->screen->post_type );
if ( $this->is_trash )
if ( $this->is_trash ) {
$actions['untrash'] = __( 'Restore' );
else
} else {
$actions['edit'] = __( 'Edit' );
}
if ( $this->is_trash || !EMPTY_TRASH_DAYS )
$actions['delete'] = __( 'Delete Permanently' );
else
$actions['trash'] = __( 'Move to Trash' );
if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
$actions['delete'] = __( 'Delete Permanently' );
} else {
$actions['trash'] = __( 'Move to Trash' );
}
}
return $actions;
}