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.


git-svn-id: https://develop.svn.wordpress.org/trunk@29757 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-09-23 02:57:43 +00:00
parent f00f28cce0
commit e97e5048c3
1 changed files with 11 additions and 6 deletions

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;
}