Make WordPress Core

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#20175 closed defect (bug) (fixed)

"Trash" should not be a bulk action when user can't delete a post at all

Reported by: markoheijnen's profile markoheijnen Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.1 Priority: normal
Severity: normal Version: 3.3.1
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

When a user can't delete posts at all for a certain post type the bulk action to delete posts is useless.

Not sure if the following check is correct:

		if ( current_user_can( $post_type_object->cap->delete_post ) ) {
			if ( $this->is_trash || !EMPTY_TRASH_DAYS )
				$actions['delete'] = __( 'Delete Permanently' );
			else
				$actions['trash'] = __( 'Move to Trash' );
		}

Maybe the edit/restore functionality should have some similar check

Attachments (1)

trash-patch.patch (811 bytes) - added by mvd7793 12 years ago.
Fixes the bug in ticket 20175

Download all attachments as: .zip

Change History (9)

#1 @coffee2code
12 years ago

  • Keywords needs-patch added
  • Version set to 3.3.1

#2 @nacin
12 years ago

delete_posts should be plural. Otherwise, seems good at a glance.

@mvd7793
12 years ago

Fixes the bug in ticket 20175

#3 @mvd7793
12 years ago

  • Keywords has-patch added; needs-patch removed

#4 @mvd7793
12 years ago

  • Cc mvd7793 added

#5 @nacin
11 years ago

  • Component changed from Trash to Posts, Post Types

#6 @danielbachhuber
10 years ago

  • Milestone changed from Awaiting Review to 4.1

I just stumbled upon this too. Patch looks good.

#7 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 29757:

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.

#8 @nacin
10 years ago

Looks good.

Note: See TracTickets for help on using tickets.