Make WordPress Core


Ignore:
Timestamp:
03/18/2013 09:11:06 PM (12 years ago)
Author:
azaozz
Message:

Bulk actions: do not move locked posts to the trash, props pdclark, see #23792

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r23681 r23747  
    4949    check_admin_referer('bulk-posts');
    5050
    51     $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
     51    $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() );
    5252    if ( ! $sendback )
    5353        $sendback = admin_url( $parent_file );
     
    7676    switch ( $doaction ) {
    7777        case 'trash':
    78             $trashed = 0;
     78            $trashed = $locked = 0;
     79
    7980            foreach( (array) $post_ids as $post_id ) {
    8081                if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
    8182                    wp_die( __('You are not allowed to move this item to the Trash.') );
    8283
     84                if ( wp_check_post_lock( $post_id ) ) {
     85                    $locked++;
     86                    continue;
     87                }
     88
    8389                if ( !wp_trash_post($post_id) )
    8490                    wp_die( __('Error in moving to Trash.') );
     
    8692                $trashed++;
    8793            }
    88             $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback );
     94
     95            $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback );
    8996            break;
    9097        case 'untrash':
Note: See TracChangeset for help on using the changeset viewer.