WordPress.org

Make WordPress Core

Changeset 8140


Ignore:
Timestamp:
06/20/2008 04:58:40 PM (12 years ago)
Author:
ryan
Message:

Actions dropdown for Posts. Props hansengel. see #7160

Location:
branches/crazyhorse/wp-admin
Files:
2 edited

Legend:

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

    r8130 r8140  
    4949    case 'cb':
    5050        ?>
    51         <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /><?php } ?></th>
     51        <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
    5252        <?php
    5353        break;
  • branches/crazyhorse/wp-admin/edit.php

    r8129 r8140  
    22require_once('admin.php');
    33
    4 // Handle bulk deletes
    5 if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
    6     check_admin_referer('bulk-posts');
    7     foreach( (array) $_GET['delete'] as $post_id_del ) {
    8         $post_del = & get_post($post_id_del);
    9 
    10         if ( !current_user_can('delete_post', $post_id_del) )
    11             wp_die( __('You are not allowed to delete this post.') );
    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...') );
    19         }
     4// Handle bulk actions
     5if ( isset($_GET['action']) && $_GET['action'] != 'Actions' ) {
     6    switch ( $_GET['action'] ) {
     7        case 'delete':
     8            if ( isset($_GET['post']) ) {
     9                check_admin_referer('bulk-posts');
     10                foreach( (array) $_GET['post'] as $post_id_del ) {
     11                    $post_del = & get_post($post_id_del);
     12
     13                    if ( !current_user_can('delete_post', $post_id_del) )
     14                        wp_die( __('You are not allowed to delete this post.') );
     15
     16                    if ( $post_del->post_type == 'attachment' ) {
     17                        if ( ! wp_delete_attachment($post_id_del) )
     18                            wp_die( __('Error in deleting...') );
     19                    } else {
     20                        if ( !wp_delete_post($post_id_del) )
     21                            wp_die( __('Error in deleting...') );
     22                    }
     23                }
     24            }
     25            break;
     26        case 'edit':
     27            // TODO: Decide what to do here - add bulk edit feature, or just disallow if >1 post selected
     28            break;
    2029    }
    21 
    2230    $sendback = wp_get_referer();
    2331    if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
     
    152160
    153161<div class="alignleft">
    154 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
     162<select name="action">
     163<option value="" selected><?php _e('Actions'); ?></option>
     164<option value="delete"><?php _e('Delete'); ?></option>
     165<option value="edit"><?php _e('Edit'); ?></option>
     166</select>
     167<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
    155168<?php wp_nonce_field('bulk-posts'); ?>
    156169<?php
Note: See TracChangeset for help on using the changeset viewer.