WordPress.org

Make WordPress Core

Ticket #29789: 29789.fix3.diff

File 29789.fix3.diff, 1.2 KB (added by DeBAAT, 4 years ago)

Alternative patch.

  • .php

    old new class WP_Posts_List_Table extends WP_List_Table { 
    282282                $actions = array();
    283283                $post_type_obj = get_post_type_object( $this->screen->post_type );
    284284
    285                 // Don't show bulk options if the user can't edit posts.
    286                 if ( ! current_user_can( $post_type_obj->cap->edit_posts ) ) {
    287                         return $actions;
     285                // Only show bulk edit options if the user can edit_posts.
     286                if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
     287                        if ( $this->is_trash ) {
     288                                $actions['untrash'] = __( 'Restore' );
     289                        } else {
     290                                $actions['edit'] = __( 'Edit' );
     291                        }
    288292                }
    289293
    290                 if ( $this->is_trash ) {
    291                         $actions['untrash'] = __( 'Restore' );
    292                 } else {
    293                         $actions['edit'] = __( 'Edit' );
    294                 }
    295 
     294                // Only show bulk delete options if the user can delete_posts.
    296295                if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
    297296                        if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
    298297                                $actions['delete'] = __( 'Delete Permanently' );