#23792 closed defect (bug) (fixed)
Disallow moving of locked posts to the trash
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Administration | Keywords: | has-patch needs-codex |
Focuses: | Cc: |
Description
Currently we don't check post locks when bulk moving posts to the trash on the All Posts screen and in wp_ajax_trash_post(). A post locked check was added when moving to the trash from the New/Edit Post screen in http://core.trac.wordpress.org/changeset/23661#file5.
The new UI on the All Posts screen prevents selecting a locked post for bulk actions, but we still should make sure a post is not locked right before moving it to the trash.
Attachments (2)
Change History (11)
#1
@
12 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 3.6
- Version set to trunk
#3
in reply to:
↑ 2
@
12 years ago
Replying to pdclark:
I left code out for wp_ajax_trash_posts() because I don't see it called or hooked anywhere
wp_ajax_trash_post()
is called via Plupload and SWFUpload handlers:
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/js/plupload/handlers.js#L139
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/js/swfupload/handlers.js#L95
#4
in reply to:
↑ 2
;
follow-up:
↓ 5
@
12 years ago
Replying to pdclark:
Sergey beat me to it :) Btw this code is unreachable now, there only for back-compat.
I've attached and tested a patch for bulk-edit.php.
We should be checking the post lock before moving to the trash, i.e. that code block needs to be above if ( !wp_trash_post($post_id) )
. Also not sure if we should exit when a post is locked, perhaps just skip it and continue moving the rest to the trash.
#5
in reply to:
↑ 4
@
12 years ago
Replying to azaozz:
We should be checking the post lock before moving to the trash, i.e. that code block needs to be above
if ( !wp_trash_post($post_id) )
. Also not sure if we should exit when a post is locked, perhaps just skip it and continue moving the rest to the trash.
Patch updated to display lock notice, and check *before* trashing posts. ;)
Requests to trash a locked posts display this notice, which already existed on edit.php line 241.
Since wp_ajax_posts() is only called for Media (plupload, swfupload, which have no post locks or trash, and it's backwards compatibility code that's not accessed from anywhere, I assume it shouldn't be modified for this ticket? Is that correct?
#7
@
12 years ago
Sweet! Thanks for the cleanup in the commit -- much nicer as a single-line defaults declaration, and good catch on adding locked to remove_query_arg()
#8
@
12 years ago
- Keywords has-patch needs-codex added; needs-patch dev-feedback removed
- Resolution set to fixed
- Status changed from new to closed
Seems like everything was covered in [23747]. Feel free to re-open if it's incomplete.
#9
@
11 years ago
I have updated Codex. http://codex.wordpress.org/Posts_Screen#Actions
This is my first attempt at editing Codex. Please let me know if this was ok.
I've attached and tested a patch for bulk-edit.php.
I left code out for wp_ajax_trash_posts() because I don't see it called or hooked anywhere, so I'm unsure how to test that output is correct. Do you know where it is used, @azaozz ?