[wp-trac] [WordPress Trac] #19826: Error behavior for deleting trashed posts is different for Bulk Delete versus Empty Trash (was: wp-die:: Same WP error. Two different behaviors.)
WordPress Trac
wp-trac at lists.automattic.com
Tue Jun 19 00:45:36 UTC 2012
#19826: Error behavior for deleting trashed posts is different for Bulk Delete
versus Empty Trash
--------------------------------------+------------------------------
Reporter: jpbellona | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Trash | Version: 3.1.2
Severity: minor | Resolution:
Keywords: ui-feedback dev-feedback |
--------------------------------------+------------------------------
Comment (by nacin):
Renaming this ticket to reflect what sounds like is the actual bug being
reported.
After looking through the code, it appears you are seeing this behavior by
pure coincidence. They both use the same code. When you use the
checkboxes, PHP receives the post IDs in the order they are on the page.
This is frequently going to be newest first. Chances are, you have let's
say 5 author posts in a row (5 newest), followed by 5 admin posts (5
oldest). Thus, it deletes all of the posts authored by the author, before
stopping at a post authored by an admin.
When you use the Empty Trash button, it does a raw query for all post IDs
that are in the trash. This results in deleting the *oldest* posts first.
Thus, it hits a post authored by the admin immediately and nothing is
deleted.
It would make the most sense to delete all relevant posts, then issue a
proper admin notice once we determine that X posts were skipped and could
not be deleted. It is not fair to issue a wp_die() when the user is
presented with both a checkbox and a 'Delete Permanently' bulk action —
they shouldn't need to know that they can't combine them for certain
posts.
Likewise, if you try to Empty Trash but you are not allowed to delete
certain posts, you should be able to delete all of the ones you can
delete. For what it's worth, though, I am not sure why there is an Empty
Trash button shown for an author -- authors do not have the
edit_others_posts capability. Perhaps you have altered this using the
Capability Manager plugin.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19826#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list