Bulk Delete - Version 0.6

Version Description

Download this release

Release Info

Developer sudar
Plugin Icon 128x128 Bulk Delete
Version 0.6
Comparing to
See all releases

Code changes from version 0.4 to 0.6

Files changed (2) hide show
  1. bulk-delete.php +38 -5
  2. readme.txt +12 -6
bulk-delete.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Bulk Delete
4
  Plugin Script: bulk-delete.php
5
  Plugin URI: http://sudarmuthu.com/wordpress/bulk-delete
6
  Description: Bulk delete posts from selected categories or tags. Use it with caution.
7
- Version: 0.4
8
  License: GPL
9
  Author: Sudar
10
  Author URI: http://sudarmuthu.com/
@@ -14,6 +14,8 @@ Author URI: http://sudarmuthu.com/
14
  2009-02-03 - v0.2 - Second release - Fixed issues with pagging
15
  2009-04-05 - v0.3 - Third release - Prevented drafts from deleted when only posts are selected
16
  2009-07-05 - v0.4 - Fourth release - Added option to delete by date.
 
 
17
 
18
  */
19
 
@@ -87,6 +89,24 @@ if (!function_exists('smbd_request_handler')) {
87
  }
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  // Pages
91
  if ("pages" == $_POST['smbd_pages']) {
92
  $pages = $wp_query->query(array('post_type'=>'page', 'nopaging'=>'true'));
@@ -120,6 +140,7 @@ if (!function_exists('smbd_displayOptions')) {
120
  ?>
121
  <div class="updated fade" style="background:#ff0;text-align:center;color: red;"><p><strong><?php _e("WARNING: Posts deleted once cannot be retrieved back. Use with caution."); ?></strong></p></div>
122
  <div class="wrap">
 
123
  <h2>Bulk Delete</h2>
124
 
125
  <h3><?php _e("Select the posts which you want to delete"); ?></h3>
@@ -132,6 +153,8 @@ if (!function_exists('smbd_displayOptions')) {
132
  $wp_query = new WP_Query;
133
  $drafts = $wp_query->query(array('post_status'=>'draft'));
134
  $revisions = $wpdb->get_results($wpdb->prepare("select * from $wpdb->posts where post_type = 'revision'"));
 
 
135
  $pages = $wp_query->query(array('post_type'=>'page'));
136
  ?>
137
  <fieldset class="options">
@@ -139,20 +162,30 @@ if (!function_exists('smbd_displayOptions')) {
139
  <tr>
140
  <td scope="row" >
141
  <input name="smbd_drafs" id ="smbd_drafs" value = "drafs" type = "checkbox" />
142
- </td>
143
- <td>
144
  <label for="smbd_drafs"><?php echo _e("All Drafts"); ?> (<?php echo count($drafts) . " "; _e("Drafts"); ?>)</label>
145
  </td>
 
 
146
  <td>
147
  <input name="smbd_revisions" id ="smbd_revisions" value = "revisions" type = "checkbox" />
 
148
  </td>
 
 
149
  <td>
150
- <label for="smbd_revisions"><?php echo _e("All Revisions"); ?> (<?php echo count($revisions) . " "; _e("Revisons"); ?>)</label>
 
151
  </td>
 
 
152
  <td>
153
- <input name="smbd_pages" value = "pages" type = "checkbox" />
 
154
  </td>
 
 
155
  <td>
 
156
  <label for="smbd_pages"><?php echo _e("All Pages"); ?> (<?php echo count($pages) . " "; _e("Pages"); ?>)</label>
157
  </td>
158
  </tr>
4
  Plugin Script: bulk-delete.php
5
  Plugin URI: http://sudarmuthu.com/wordpress/bulk-delete
6
  Description: Bulk delete posts from selected categories or tags. Use it with caution.
7
+ Version: 0.6
8
  License: GPL
9
  Author: Sudar
10
  Author URI: http://sudarmuthu.com/
14
  2009-02-03 - v0.2 - Second release - Fixed issues with pagging
15
  2009-04-05 - v0.3 - Third release - Prevented drafts from deleted when only posts are selected
16
  2009-07-05 - v0.4 - Fourth release - Added option to delete by date.
17
+ 2009-07-21 - v0.5 - Fifth release - Added option to delete all pending posts.
18
+ 2009-07-22 - v0.6 - Sixth release - Added option to delete all scheduled posts.
19
 
20
  */
21
 
89
  }
90
  }
91
 
92
+ // Pending Posts
93
+ if ("pending" == $_POST['smbd_pending']) {
94
+ $pendings = $wpdb->get_results($wpdb->prepare("select * from $wpdb->posts where post_status = 'pending'"));
95
+
96
+ foreach ($pendings as $pending) {
97
+ wp_delete_post($pending->ID);
98
+ }
99
+ }
100
+
101
+ // Future Posts
102
+ if ("future" == $_POST['smbd_future']) {
103
+ $futures = $wpdb->get_results($wpdb->prepare("select * from $wpdb->posts where post_status = 'future'"));
104
+
105
+ foreach ($futures as $future) {
106
+ wp_delete_post($future->ID);
107
+ }
108
+ }
109
+
110
  // Pages
111
  if ("pages" == $_POST['smbd_pages']) {
112
  $pages = $wp_query->query(array('post_type'=>'page', 'nopaging'=>'true'));
140
  ?>
141
  <div class="updated fade" style="background:#ff0;text-align:center;color: red;"><p><strong><?php _e("WARNING: Posts deleted once cannot be retrieved back. Use with caution."); ?></strong></p></div>
142
  <div class="wrap">
143
+ <?php screen_icon(); ?>
144
  <h2>Bulk Delete</h2>
145
 
146
  <h3><?php _e("Select the posts which you want to delete"); ?></h3>
153
  $wp_query = new WP_Query;
154
  $drafts = $wp_query->query(array('post_status'=>'draft'));
155
  $revisions = $wpdb->get_results($wpdb->prepare("select * from $wpdb->posts where post_type = 'revision'"));
156
+ $pending = $wpdb->get_results($wpdb->prepare("select * from $wpdb->posts where post_status = 'pending'"));
157
+ $future = $wpdb->get_results($wpdb->prepare("select * from $wpdb->posts where post_status = 'future'"));
158
  $pages = $wp_query->query(array('post_type'=>'page'));
159
  ?>
160
  <fieldset class="options">
162
  <tr>
163
  <td scope="row" >
164
  <input name="smbd_drafs" id ="smbd_drafs" value = "drafs" type = "checkbox" />
 
 
165
  <label for="smbd_drafs"><?php echo _e("All Drafts"); ?> (<?php echo count($drafts) . " "; _e("Drafts"); ?>)</label>
166
  </td>
167
+ </tr>
168
+ <tr>
169
  <td>
170
  <input name="smbd_revisions" id ="smbd_revisions" value = "revisions" type = "checkbox" />
171
+ <label for="smbd_revisions"><?php echo _e("All Revisions"); ?> (<?php echo count($revisions) . " "; _e("Revisons"); ?>)</label>
172
  </td>
173
+ </tr>
174
+ <tr>
175
  <td>
176
+ <input name="smbd_pending" id ="smbd_pending" value = "pending" type = "checkbox" />
177
+ <label for="smbd_pending"><?php echo _e("All Pending posts"); ?> (<?php echo count($pending) . " "; _e("Posts"); ?>)</label>
178
  </td>
179
+ </tr>
180
+ <tr>
181
  <td>
182
+ <input name="smbd_future" id ="smbd_future" value = "future" type = "checkbox" />
183
+ <label for="smbd_future"><?php echo _e("All scheduled posts"); ?> (<?php echo count($future) . " "; _e("Posts"); ?>)</label>
184
  </td>
185
+ </tr>
186
+ <tr>
187
  <td>
188
+ <input name="smbd_pages" value = "pages" type = "checkbox" />
189
  <label for="smbd_pages"><?php echo _e("All Pages"); ?> (<?php echo count($pages) . " "; _e("Pages"); ?>)</label>
190
  </td>
191
  </tr>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sudar
3
  Tags: post, comment, delete, bulk, draft, revision, page
4
  Requires at least: 2.0
5
- Tested up to: 2.8.1
6
- Stable tag: 0.4
7
 
8
  Bulk delete posts from selected categories or tags
9
 
@@ -24,22 +24,28 @@ Extract the zip file and just drop the contents in the wp-content/plugins/ direc
24
 
25
  == Changelog ==
26
 
27
- **v0.1 (2009-02-02)**
28
 
29
  * first version
30
 
31
- **v0.2 (2009-02-03)**
32
 
33
  * Fixed issues with pagging
34
 
35
- **v0.3 (2009-04-05)**
36
 
37
  * Prevented drafts from deleted when only posts are selected
38
 
39
- **v0.4 (2009-07-05)**
40
 
41
  * Added option to delete by date.
42
 
 
 
 
 
 
 
43
  ==Readme Generator==
44
 
45
  This Readme file was generated using <a href = 'http://sudarmuthu.com/projects/wp-readme.php'>wp-readme</a>, which generates readme files for WordPress Plugins.
2
  Contributors: sudar
3
  Tags: post, comment, delete, bulk, draft, revision, page
4
  Requires at least: 2.0
5
+ Tested up to: 2.8.2
6
+ Stable tag: 0.6
7
 
8
  Bulk delete posts from selected categories or tags
9
 
24
 
25
  == Changelog ==
26
 
27
+ ###v0.1 (2009-02-02)
28
 
29
  * first version
30
 
31
+ ###v0.2 (2009-02-03)
32
 
33
  * Fixed issues with pagging
34
 
35
+ ###v0.3 (2009-04-05)
36
 
37
  * Prevented drafts from deleted when only posts are selected
38
 
39
+ ###v0.4 (2009-07-05)
40
 
41
  * Added option to delete by date.
42
 
43
+ ###v0.5 (2009-07-21)
44
+ * Added option to delete all pending posts.
45
+
46
+ ###v0.6 (2009-07-22)
47
+ * Added option to delete all scheduled posts.
48
+
49
  ==Readme Generator==
50
 
51
  This Readme file was generated using <a href = 'http://sudarmuthu.com/projects/wp-readme.php'>wp-readme</a>, which generates readme files for WordPress Plugins.