mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Bulk actions: do not move locked posts to the trash, props pdclark, see #23792
git-svn-id: http://core.svn.wordpress.org/trunk@23747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e3590b9637
commit
043d31609f
@ -48,7 +48,7 @@ $doaction = $wp_list_table->current_action();
|
||||
if ( $doaction ) {
|
||||
check_admin_referer('bulk-posts');
|
||||
|
||||
$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
|
||||
$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() );
|
||||
if ( ! $sendback )
|
||||
$sendback = admin_url( $parent_file );
|
||||
$sendback = add_query_arg( 'paged', $pagenum, $sendback );
|
||||
@ -75,17 +75,24 @@ if ( $doaction ) {
|
||||
|
||||
switch ( $doaction ) {
|
||||
case 'trash':
|
||||
$trashed = 0;
|
||||
$trashed = $locked = 0;
|
||||
|
||||
foreach( (array) $post_ids as $post_id ) {
|
||||
if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
|
||||
wp_die( __('You are not allowed to move this item to the Trash.') );
|
||||
|
||||
if ( wp_check_post_lock( $post_id ) ) {
|
||||
$locked++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !wp_trash_post($post_id) )
|
||||
wp_die( __('Error in moving to Trash.') );
|
||||
|
||||
$trashed++;
|
||||
}
|
||||
$sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback );
|
||||
|
||||
$sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback );
|
||||
break;
|
||||
case 'untrash':
|
||||
$untrashed = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user