WordPress.org

Make WordPress Core

Changeset 8156


Ignore:
Timestamp:
06/21/08 14:32:26 (6 years ago)
Author:
hansengel
Message:

Actions dropdown for Pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/crazyhorse/wp-admin/edit-pages.php

    r8124 r8156  
    33 
    44// Handle bulk deletes 
    5 if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) { 
     5if ( isset($_GET['action']) && isset($_GET['delete']) ) { 
    66    check_admin_referer('bulk-pages'); 
    7     foreach( (array) $_GET['delete'] as $post_id_del ) { 
    8         $post_del = & get_post($post_id_del); 
    9  
    10         if ( !current_user_can('delete_page', $post_id_del) ) 
    11             wp_die( __('You are not allowed to delete this page.') ); 
    12  
    13         if ( $post_del->post_type == 'attachment' ) { 
    14             if ( ! wp_delete_attachment($post_id_del) ) 
    15                 wp_die( __('Error in deleting...') ); 
    16         } else { 
    17             if ( !wp_delete_post($post_id_del) ) 
    18                 wp_die( __('Error in deleting...') ); 
     7    if ( $_GET['action'] == 'delete' ) { 
     8        foreach( (array) $_GET['delete'] as $post_id_del ) { 
     9            $post_del = & get_post($post_id_del); 
     10 
     11            if ( !current_user_can('delete_page', $post_id_del) ) 
     12                wp_die( __('You are not allowed to delete this page.') ); 
     13 
     14            if ( $post_del->post_type == 'attachment' ) { 
     15                if ( ! wp_delete_attachment($post_id_del) ) 
     16                    wp_die( __('Error in deleting...') ); 
     17            } else { 
     18                if ( !wp_delete_post($post_id_del) ) 
     19                    wp_die( __('Error in deleting...') ); 
     20            } 
    1921        } 
     22 
     23        $sendback = wp_get_referer(); 
     24        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php'); 
     25        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 
     26        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 
     27 
     28        wp_redirect($sendback); 
     29        exit(); 
    2030    } 
    21  
    22     $sendback = wp_get_referer(); 
    23     if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php'); 
    24     elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php'); 
    25     $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 
    26  
    27     wp_redirect($sendback); 
    28     exit(); 
    2931} elseif ( !empty($_GET['_wp_http_referer']) ) { 
    3032     wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); 
     
    143145 
    144146<div class="alignleft"> 
    145 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" /> 
     147<select name="action"> 
     148<option value="" selected><?php _e('Actions'); ?></option> 
     149<option value="delete"><?php _e('Delete'); ?></option> 
     150</select> 
     151<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" /> 
    146152<?php wp_nonce_field('bulk-pages'); ?> 
    147153</div> 
Note: See TracChangeset for help on using the changeset viewer.