Version Description
- Added Delete Comments
- Added Delete Users
- Added Delete Postmeta fields
- Added Delete Usermeta fields
- Added Delete Commentmeta fields
- Added Delete Taxonomy Terms
- Added Cleanup
Download this release
Release Info
Developer | xylus |
Plugin | WP Bulk Delete |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
- README.txt +140 -28
- assets/css/wp-bulk-delete-admin.css +20 -1
- assets/images/xt_logo.png +0 -0
- assets/js/wp-bulk-delete-admin.js +115 -1
- includes/admin/admin-pages.php +3 -3
- includes/admin/admin-sidebar.php +49 -0
- includes/admin/cleanup/cleanup-form.php +99 -0
- includes/admin/cleanup/cleanup-page.php +50 -0
- includes/admin/comments/display-delete-comments.php +26 -8
- includes/admin/meta/display-delete-meta.php +28 -7
- includes/admin/meta/wp-bulk-delete-meta.php +51 -0
- includes/admin/posts/display-delete-posts.php +8 -8
- includes/admin/posts/post-cleanup.php +0 -69
- includes/admin/posts/wp-bulk-delete-posts.php +2 -24
- includes/admin/taxonomy/display-delete-taxonomy.php +0 -52
- includes/admin/terms/display-delete-terms.php +69 -0
- includes/admin/users/display-delete-users.php +22 -7
- includes/ajax-functions.php +267 -3
- includes/class-delete-api.php +866 -7
- includes/common-functions.php +69 -0
- includes/delele-comments-form-functions.php +188 -0
- includes/delele-meta-form-functions.php +366 -0
- includes/delele-posts-form-functions.php +10 -10
- includes/delele-terms-form-functions.php +95 -0
- includes/delele-users-form-functions.php +201 -0
- includes/scripts.php +4 -3
- wp-bulk-delete.php +31 -25
README.txt
CHANGED
@@ -1,37 +1,133 @@
|
|
1 |
=== WP Bulk Delete ===
|
2 |
Contributors: xylus
|
3 |
Donate link: http://xylusthemes.com
|
4 |
-
Tags: delete, bulk, clean, bulk delete, bulk clean, posts delete, delete all, mass delete, posts delete, delete posts, delete comments, delete users, delete meta, delete taxonomy, delete revision, wp clean, clean trash, trash, clean
|
5 |
Requires at least: 3.9
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
Bulk delete
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
WP Bulk Delete allows you to delete
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
|
19 |
* Delete Posts.
|
20 |
-
* Delete
|
21 |
-
* Delete
|
22 |
-
* Delete Posts by
|
23 |
-
* Delete Posts by
|
24 |
-
* Delete Posts by
|
25 |
-
* Delete
|
26 |
-
* Delete
|
27 |
-
* Delete
|
28 |
-
* Delete
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
== Installation ==
|
37 |
|
@@ -51,15 +147,31 @@ WP Bulk Delete allows you to delete and clean anything like posts, comments, use
|
|
51 |
|
52 |
== Screenshots ==
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
= 1.0.0 =
|
65 |
* Initial Version.
|
1 |
=== WP Bulk Delete ===
|
2 |
Contributors: xylus
|
3 |
Donate link: http://xylusthemes.com
|
4 |
+
Tags: delete, bulk, clean, bulk delete, bulk clean, posts delete, delete all, mass delete, posts delete, delete posts, delete comments, delete users, delete meta, delete taxonomy, delete revision, wp clean, clean trash, bulk user delete, delete all, delete all users, delete all comments, delete all posts, trash, clean spam, delete with condition, delete with filter, remove
|
5 |
Requires at least: 3.9
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
WP Bulk delete allows you to delete posts, pages, comments, attachments, users, taxonomy terms and meta fields in bulk based with different powerful filters and conditions.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
WP Bulk Delete is a WordPress Plugin that allows you to delete posts, pages, comments, attachments, users, taxonomy terms and meta fields in bulk based with different powerful filters and conditions. WP bulk delete helps in finding and mass deleting unnecessary data clean up. It also helps in imporving Speed and reducing database load.
|
16 |
|
17 |
+
|
18 |
+
###Powerfull Features
|
19 |
+
WP bulk Delete support below powerfull conditions and filters.
|
20 |
+
|
21 |
+
#### Deleting posts
|
22 |
|
23 |
* Delete Posts.
|
24 |
+
* Delete posts by category
|
25 |
+
* Delete posts by tag
|
26 |
+
* Delete Posts by custom post type
|
27 |
+
* Delete Posts by post status
|
28 |
+
* Delete Posts by date interval
|
29 |
+
* Delete Posts by custom Taxonomy
|
30 |
+
* Delete Posts by authors
|
31 |
+
* Delete Post by meta fields
|
32 |
+
* Delete Posts by title or content. [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
33 |
+
* Delete Posts by custom fields. [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
34 |
+
* Delete Posts by any filters. [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
35 |
+
* Delete Posts by any conditions. [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
36 |
+
|
37 |
+
#### Delete post by conditions & filters
|
38 |
+
|
39 |
+
* Post date greater than X days
|
40 |
+
* Post date less than X days
|
41 |
+
* Post in date range
|
42 |
+
* Only public posts
|
43 |
+
* Only private posts
|
44 |
+
* Restrict to first N posts
|
45 |
+
* Delete permanently or just move to trash
|
46 |
+
* Schedule deletion of posts automatically (not yet working on it)
|
47 |
+
* Post by Category
|
48 |
+
* Post by Author
|
49 |
+
* Post by status published,pending etc
|
50 |
+
* Delete Duplicate Post (comming soon)
|
51 |
+
|
52 |
+
#### Delete Comments
|
53 |
+
|
54 |
+
* Delete Comments
|
55 |
+
* Delete Comments by status
|
56 |
+
* Delete Comments by date interval
|
57 |
+
* Delete Comments by comment author. [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
58 |
+
* Delete Comments by comment post. [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
59 |
+
* Delete Commets by conditions & filters
|
60 |
+
|
61 |
+
#### Delete users
|
62 |
+
|
63 |
+
* Delete Users
|
64 |
+
* Delete Users by user roles
|
65 |
+
* Delete Users by date interval
|
66 |
+
* Delete users based on their registered date
|
67 |
+
* Delete users who have not logged in in the last X days
|
68 |
+
* Delete Users by user meta fields
|
69 |
+
* Assign deleted user data to another user. [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
70 |
+
|
71 |
+
|
72 |
+
#### Delete Meta fields
|
73 |
+
|
74 |
+
* Delete Post Meta fields
|
75 |
+
* Delete User meta fields
|
76 |
+
* Delete Comment meta fields
|
77 |
+
* Delete Taxonomy terms
|
78 |
+
|
79 |
+
|
80 |
+
#### Deleting Attachments
|
81 |
+
|
82 |
+
* Delete Attachments
|
83 |
+
|
84 |
+
#### Database Cleanup
|
85 |
+
|
86 |
+
* Delete Auto Drafts
|
87 |
+
* Delete Trash post
|
88 |
+
* Delete Revisions
|
89 |
+
* Delete Orphaned Meta
|
90 |
+
* Delete Duplicate Meta
|
91 |
+
* Bulk Delete Post
|
92 |
+
* Mass Delete Post
|
93 |
+
|
94 |
+
|
95 |
+
#### Deleting pages
|
96 |
+
|
97 |
+
* Delete all published pages
|
98 |
+
* Delete all draft pages
|
99 |
+
* Delete all pending pages
|
100 |
+
* Delete all private pages
|
101 |
+
* Delete all scheduled pages
|
102 |
+
* Delete all pages from trash
|
103 |
+
* Delete all revisions pages
|
104 |
+
* Delete all trash pages
|
105 |
+
|
106 |
+
#### Deleting post revisions
|
107 |
+
|
108 |
+
* Delete all post revisions
|
109 |
+
* Delete all page revisions
|
110 |
+
* Delete all Custom Post Type Revisions
|
111 |
+
|
112 |
+
#### WP Bulk Delete [PRO Version](https://xylusthemes.com/plugins/wp-bulk-delete/)
|
113 |
+
|
114 |
+
|
115 |
+
We are working on providing more options :)
|
116 |
+
|
117 |
+
### Support
|
118 |
+
|
119 |
+
*If you have found a bug/issue or have a feature request, then post them in [Support ticket][1]
|
120 |
+
*If you have a question about the plugin usage or need help to troubleshoot, then post about it in our [BulkWP Support forums][1]
|
121 |
+
*If you have a question about any of the addon or need help to troubleshoot the addons, then post about it in our [WP Bulk delete Support][1]
|
122 |
+
*If you like the Plugin, then kindly leave a review/feedback at [WordPress repo page][2]. This will help more people to discover the plugin.
|
123 |
+
*Checkout other [WordPress Plugins][3] that we have written
|
124 |
+
|
125 |
+
|
126 |
+
[1]: https://xylusthemes.com/support/
|
127 |
+
[2]: https://wordpress.org/support/plugin/wp-bulk-delete/reviews/
|
128 |
+
[3]: https://xylusthemes.com/plugins/
|
129 |
+
|
130 |
+
|
131 |
|
132 |
== Installation ==
|
133 |
|
147 |
|
148 |
== Screenshots ==
|
149 |
|
150 |
+
|
151 |
+
1. Delete posts by post types.
|
152 |
+
2. Delete posts by taxonomy.
|
153 |
+
3. Delete posts by authors.
|
154 |
+
4. Delete posts by title and content.
|
155 |
+
5. Delete posts by custom fields.
|
156 |
+
6. Delete posts by all (general).
|
157 |
+
7. Delete Comments
|
158 |
+
8. Delete Users
|
159 |
+
9. Delete Postmeta
|
160 |
+
10. Delete Usermeta
|
161 |
+
11. Delete Commentmeta
|
162 |
+
12. Delete Taxonomy Terms
|
163 |
+
13. Cleanup
|
164 |
|
165 |
== Changelog ==
|
166 |
|
167 |
+
= 1.1.0 =
|
168 |
+
* Added Delete Comments
|
169 |
+
* Added Delete Users
|
170 |
+
* Added Delete Postmeta fields
|
171 |
+
* Added Delete Usermeta fields
|
172 |
+
* Added Delete Commentmeta fields
|
173 |
+
* Added Delete Taxonomy Terms
|
174 |
+
* Added Cleanup
|
175 |
+
|
176 |
= 1.0.0 =
|
177 |
* Initial Version.
|
assets/css/wp-bulk-delete-admin.css
CHANGED
@@ -1,4 +1,23 @@
|
|
1 |
/**
|
2 |
* All of the CSS for your admin-specific functionality should be
|
3 |
* included in this file.
|
4 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* All of the CSS for your admin-specific functionality should be
|
3 |
* included in this file.
|
4 |
+
*/
|
5 |
+
.upgrade_to_pro{
|
6 |
+
padding-top: 100px;
|
7 |
+
padding: 15px;
|
8 |
+
border-radius: 2px;
|
9 |
+
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
10 |
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
11 |
+
margin-bottom: 20px;
|
12 |
+
background: url('../images/xt_logo.png') no-repeat bottom 5%right 5% #fff;
|
13 |
+
background-size: 20%;
|
14 |
+
}
|
15 |
+
.upgrade_to_pro h2{
|
16 |
+
font-size: 22px !important;
|
17 |
+
padding: 0px !important;
|
18 |
+
}
|
19 |
+
.upgrade_button{
|
20 |
+
height: 36px !important;
|
21 |
+
padding: 4px 20px !important;
|
22 |
+
font-size: 16px !important;
|
23 |
+
}
|
assets/images/xt_logo.png
ADDED
Binary file
|
assets/js/wp-bulk-delete-admin.js
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
jQuery(".delete_notice").html('<div class="notice notice-success"><p><strong>' + response.messages + '</strong></p></div>');
|
55 |
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
|
56 |
} else if( response.status == 1 ){
|
57 |
-
if ( confirm( response.post_count + '
|
58 |
jQuery("#delete_posts_form").submit();
|
59 |
}
|
60 |
}
|
@@ -113,4 +113,118 @@
|
|
113 |
});
|
114 |
});
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
})( jQuery );
|
54 |
jQuery(".delete_notice").html('<div class="notice notice-success"><p><strong>' + response.messages + '</strong></p></div>');
|
55 |
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
|
56 |
} else if( response.status == 1 ){
|
57 |
+
if ( confirm( response.post_count + ' posts will be delete. Would you like to proceed further?' ) ){
|
58 |
jQuery("#delete_posts_form").submit();
|
59 |
}
|
60 |
}
|
113 |
});
|
114 |
});
|
115 |
|
116 |
+
|
117 |
+
// Delete users form handle.
|
118 |
+
jQuery(document).ready(function() {
|
119 |
+
jQuery('#delete_users_submit').on( 'click', function() {
|
120 |
+
var deleteuserform = jQuery("#delete_users_form").serialize();
|
121 |
+
var data = {
|
122 |
+
'action': 'delete_users_count',
|
123 |
+
'form': deleteuserform
|
124 |
+
};
|
125 |
+
jQuery(".spinner").addClass("is-active");
|
126 |
+
jQuery.post(ajaxurl, data, function(response) {
|
127 |
+
if( response != '' ){
|
128 |
+
var response = jQuery.parseJSON( response );
|
129 |
+
if( response.status == 0 ){
|
130 |
+
jQuery(".delete_notice").html('<div class="notice notice-error"><p><strong>' + response.messages + '</strong></p></div>');
|
131 |
+
} else if( response.status == 2 ){
|
132 |
+
jQuery(".delete_notice").html('<div class="notice notice-success"><p><strong>' + response.messages + '</strong></p></div>');
|
133 |
+
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
|
134 |
+
} else if( response.status == 1 ){
|
135 |
+
if ( confirm( response.post_count + ' users will be delete. Would you like to proceed further?' ) ){
|
136 |
+
jQuery("#delete_users_form").submit();
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
jQuery(".spinner").removeClass("is-active");
|
141 |
+
});
|
142 |
+
});
|
143 |
+
});
|
144 |
+
|
145 |
+
// Delete comments form handle.
|
146 |
+
jQuery(document).ready(function() {
|
147 |
+
jQuery('#delete_comments_submit').on( 'click', function() {
|
148 |
+
var deletecommentform = jQuery("#delete_comments_form").serialize();
|
149 |
+
var data = {
|
150 |
+
'action': 'delete_comments_count',
|
151 |
+
'form': deletecommentform
|
152 |
+
};
|
153 |
+
jQuery(".spinner").addClass("is-active");
|
154 |
+
jQuery.post(ajaxurl, data, function(response) {
|
155 |
+
if( response != '' ){
|
156 |
+
var response = jQuery.parseJSON( response );
|
157 |
+
if( response.status == 0 ){
|
158 |
+
jQuery(".delete_notice").html('<div class="notice notice-error"><p><strong>' + response.messages + '</strong></p></div>');
|
159 |
+
} else if( response.status == 2 ){
|
160 |
+
jQuery(".delete_notice").html('<div class="notice notice-success"><p><strong>' + response.messages + '</strong></p></div>');
|
161 |
+
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
|
162 |
+
} else if( response.status == 1 ){
|
163 |
+
if ( confirm( response.post_count + ' comments will be delete. Would you like to proceed further?' ) ){
|
164 |
+
jQuery("#delete_comments_form").submit();
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
jQuery(".spinner").removeClass("is-active");
|
169 |
+
});
|
170 |
+
});
|
171 |
+
});
|
172 |
+
|
173 |
+
// Delete meta form handle.
|
174 |
+
jQuery(document).ready(function() {
|
175 |
+
jQuery('#delete_meta_submit').on( 'click', function() {
|
176 |
+
var metaform = jQuery("#delete_meta_form").serialize();
|
177 |
+
var data = {
|
178 |
+
'action': 'delete_meta_count',
|
179 |
+
'form': metaform
|
180 |
+
};
|
181 |
+
jQuery(".spinner").addClass("is-active");
|
182 |
+
jQuery.post(ajaxurl, data, function(response) {
|
183 |
+
if( response != '' ){
|
184 |
+
var response = jQuery.parseJSON( response );
|
185 |
+
if( response.status == 0 ){
|
186 |
+
jQuery(".delete_notice").html('<div class="notice notice-error"><p><strong>' + response.messages + '</strong></p></div>');
|
187 |
+
} else if( response.status == 2 ){
|
188 |
+
jQuery(".delete_notice").html('<div class="notice notice-success"><p><strong>' + response.messages + '</strong></p></div>');
|
189 |
+
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
|
190 |
+
} else if( response.status == 1 ){
|
191 |
+
if ( confirm( response.post_count + ' meta will be delete. Would you like to proceed further?' ) ){
|
192 |
+
jQuery("#delete_meta_form").submit();
|
193 |
+
}
|
194 |
+
}
|
195 |
+
}
|
196 |
+
jQuery(".spinner").removeClass("is-active");
|
197 |
+
});
|
198 |
+
});
|
199 |
+
});
|
200 |
+
|
201 |
+
|
202 |
+
// Delete meta form handle.
|
203 |
+
jQuery(document).ready(function() {
|
204 |
+
jQuery('#delete_terms_submit').on( 'click', function() {
|
205 |
+
var termform = jQuery("#delete_terms_form").serialize();
|
206 |
+
var data = {
|
207 |
+
'action': 'delete_terms_count',
|
208 |
+
'form': termform
|
209 |
+
};
|
210 |
+
jQuery(".spinner").addClass("is-active");
|
211 |
+
jQuery.post(ajaxurl, data, function(response) {
|
212 |
+
if( response != '' ){
|
213 |
+
var response = jQuery.parseJSON( response );
|
214 |
+
if( response.status == 0 ){
|
215 |
+
jQuery(".delete_notice").html('<div class="notice notice-error"><p><strong>' + response.messages + '</strong></p></div>');
|
216 |
+
} else if( response.status == 2 ){
|
217 |
+
jQuery(".delete_notice").html('<div class="notice notice-success"><p><strong>' + response.messages + '</strong></p></div>');
|
218 |
+
jQuery("html, body").animate({ scrollTop: 0 }, "slow");
|
219 |
+
} else if( response.status == 1 ){
|
220 |
+
if ( confirm( response.post_count + ' Terms will be delete. Would you like to proceed further?' ) ){
|
221 |
+
jQuery("#delete_terms_form").submit();
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
jQuery(".spinner").removeClass("is-active");
|
226 |
+
});
|
227 |
+
});
|
228 |
+
});
|
229 |
+
|
230 |
})( jQuery );
|
includes/admin/admin-pages.php
CHANGED
@@ -16,7 +16,6 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
16 |
* Create the Admin menu and submenu and assign their links to global varibles.
|
17 |
*
|
18 |
* @since 1.0
|
19 |
-
* @param string $hook Page hook
|
20 |
* @return void
|
21 |
*/
|
22 |
function wpbd_add_menu_pages() {
|
@@ -30,9 +29,10 @@ function wpbd_add_menu_pages() {
|
|
30 |
|
31 |
$xt_delete_users_page = add_submenu_page( 'delete_all_posts', __( 'Delete Users', 'wp-bulk-delete' ), __( 'Delete Users', 'wp-bulk-delete' ), 'manage_options', 'delete_all_users', 'wpbd_delete_users_page' );
|
32 |
|
33 |
-
$xt_delete_meta_page = add_submenu_page( 'delete_all_posts', __( 'Delete Meta', 'wp-bulk-delete' ), __( 'Delete Meta', 'wp-bulk-delete' ), 'manage_options', 'delete_all_meta', 'wpbd_delete_meta_page' );
|
34 |
|
35 |
-
$xt_delete_taxonomy_page = add_submenu_page( 'delete_all_posts', __( 'Delete
|
36 |
|
|
|
37 |
}
|
38 |
add_action( 'admin_menu', 'wpbd_add_menu_pages', 10 );
|
16 |
* Create the Admin menu and submenu and assign their links to global varibles.
|
17 |
*
|
18 |
* @since 1.0
|
|
|
19 |
* @return void
|
20 |
*/
|
21 |
function wpbd_add_menu_pages() {
|
29 |
|
30 |
$xt_delete_users_page = add_submenu_page( 'delete_all_posts', __( 'Delete Users', 'wp-bulk-delete' ), __( 'Delete Users', 'wp-bulk-delete' ), 'manage_options', 'delete_all_users', 'wpbd_delete_users_page' );
|
31 |
|
32 |
+
$xt_delete_meta_page = add_submenu_page( 'delete_all_posts', __( 'Delete Meta Fields', 'wp-bulk-delete' ), __( 'Delete Meta Fields', 'wp-bulk-delete' ), 'manage_options', 'delete_all_meta', 'wpbd_delete_meta_page' );
|
33 |
|
34 |
+
$xt_delete_taxonomy_page = add_submenu_page( 'delete_all_posts', __( 'Delete Terms', 'wp-bulk-delete' ), __( 'Delete Terms', 'wp-bulk-delete' ), 'manage_options', 'wpbd_delete_terms', 'wpbd_delete_terms_page' );
|
35 |
|
36 |
+
$xt_delete_taxonomy_page = add_submenu_page( 'delete_all_posts', __( 'Cleanup', 'wp-bulk-delete' ), __( 'Cleanup', 'wp-bulk-delete' ), 'manage_options', 'wpbd_cleanup', 'wpbd_render_cleanup_page' );
|
37 |
}
|
38 |
add_action( 'admin_menu', 'wpbd_add_menu_pages', 10 );
|
includes/admin/admin-sidebar.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sidebar for Admin Pages
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Admin/Pages
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Render Sidebar for Admin Pages.
|
17 |
+
*
|
18 |
+
* @since 1.1.0
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
function wpbd_admin_sidebar() {
|
22 |
+
?>
|
23 |
+
<div class="upgrade_to_pro">
|
24 |
+
<h2><?php esc_html_e( 'Upgrade to Pro','wp-bulk-delete'); ?></h2>
|
25 |
+
<p><?php esc_html_e( 'Unlock more power to bulk delete operation, Upgrade today!!','wp-bulk-delete'); ?></p>
|
26 |
+
<a class="button button-primary upgrade_button" href="<?php echo esc_url(WPBD_PLUGIN_BUY_NOW_URL); ?>" target="_blank">
|
27 |
+
<?php esc_html_e( 'Upgrade to Pro','wp-bulk-delete'); ?>
|
28 |
+
</a>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<div class="upgrade_to_pro">
|
32 |
+
<h2><?php esc_html_e( 'Custom WordPress Development Services','wp-bulk-delete'); ?></h2>
|
33 |
+
<p><?php esc_html_e( "From small blog to complex web apps, we push the limits of what's possible with WordPress.","wp-bulk-delete" ); ?></p>
|
34 |
+
<a class="button button-primary upgrade_button" href="<?php echo esc_url('https://xylusthemes.com/contact/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin'); ?>" target="_blank">
|
35 |
+
<?php esc_html_e( 'Hire Us','wp-bulk-delete'); ?>
|
36 |
+
</a>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<div>
|
40 |
+
<p style="text-align:center">
|
41 |
+
<strong><?php esc_html_e( 'Would you like to remove these ads?','wp-bulk-delete'); ?></strong><br>
|
42 |
+
<a href="<?php echo esc_url(WPBD_PLUGIN_BUY_NOW_URL); ?>" target="_blank">
|
43 |
+
<?php esc_html_e( 'Get Premium','wp-bulk-delete'); ?>
|
44 |
+
</a>
|
45 |
+
</p>
|
46 |
+
</div>
|
47 |
+
<?php
|
48 |
+
}
|
49 |
+
add_action( 'wpbd_admin_sidebar', 'wpbd_admin_sidebar', 10 );
|
includes/admin/cleanup/cleanup-form.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Cleanup form
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Admin/Pages
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Cleanup form
|
16 |
+
*
|
17 |
+
* Render the Cleanup form
|
18 |
+
*
|
19 |
+
* @since 1.1.0
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
function wpbd_cleanup_form( $type = 'general' ){
|
23 |
+
|
24 |
+
if( ! empty( $_POST ) && isset( $_POST['run_post_cleanup'] ) ){
|
25 |
+
$messages = $error = array();
|
26 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
27 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( isset( $_POST['_run_post_cleanup_wpnonce'] ) && wp_verify_nonce( $_POST['_run_post_cleanup_wpnonce'], 'run_post_cleanup_nonce' ) && empty( $error ) ) {
|
31 |
+
$cleanups = $_POST['cleanup_post_type'];
|
32 |
+
if( ! empty( $cleanups ) ){
|
33 |
+
foreach ($cleanups as $cleanuptype ) {
|
34 |
+
$messages[] = wpbulkdelete()->api->run_cleanup( $cleanuptype );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}else{
|
38 |
+
wp_die( esc_html__( 'Sorry, Your nonce did not verify.', 'wp-bulk-delete' ) );
|
39 |
+
}
|
40 |
+
|
41 |
+
if( !empty( $error ) ){
|
42 |
+
foreach ( $error as $err ) {
|
43 |
+
?>
|
44 |
+
<div class="notice notice-error">
|
45 |
+
<p><strong><?php echo $err; ?></strong></p>
|
46 |
+
</div>
|
47 |
+
<?php
|
48 |
+
}
|
49 |
+
}
|
50 |
+
if( ! empty( $messages ) ){
|
51 |
+
if (strlen(implode($messages)) == 0 ){
|
52 |
+
?>
|
53 |
+
<div class="notice notice-success">
|
54 |
+
<p><strong><?php esc_html_e( 'Nothing to cleanup!!', 'wp-bulk-delete' ); ?></strong></p>
|
55 |
+
</div>
|
56 |
+
<?php
|
57 |
+
}else{
|
58 |
+
foreach ( $messages as $message ) {
|
59 |
+
if( $message != '' ){
|
60 |
+
?>
|
61 |
+
<div class="notice notice-success">
|
62 |
+
<p><strong><?php echo $message; ?></strong></p>
|
63 |
+
</div>
|
64 |
+
<?php
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
?>
|
71 |
+
<form method="post" id="cleanup">
|
72 |
+
<table class="form-table">
|
73 |
+
<tbody>
|
74 |
+
<?php
|
75 |
+
if( 'general' == $type ) {
|
76 |
+
|
77 |
+
wpbd_render_post_cleanup();
|
78 |
+
wpbd_render_meta_cleanup();
|
79 |
+
|
80 |
+
}elseif( 'post' == $type ) {
|
81 |
+
|
82 |
+
wpbd_render_post_cleanup();
|
83 |
+
|
84 |
+
}elseif( 'meta' == $type ) {
|
85 |
+
|
86 |
+
wpbd_render_meta_cleanup();
|
87 |
+
|
88 |
+
}
|
89 |
+
wp_nonce_field('run_post_cleanup_nonce', '_run_post_cleanup_wpnonce' );
|
90 |
+
|
91 |
+
?>
|
92 |
+
</tbody>
|
93 |
+
</table>
|
94 |
+
<?php
|
95 |
+
submit_button( __('Run Cleanup','wp-bulk-delete'), 'primary','run_post_cleanup');
|
96 |
+
?>
|
97 |
+
</form>
|
98 |
+
<?php
|
99 |
+
}
|
includes/admin/cleanup/cleanup-page.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Cleanup page
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Admin/Pages
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Cleanup Page
|
16 |
+
*
|
17 |
+
* Render the Cleanup page
|
18 |
+
*
|
19 |
+
* @since 1.1.0
|
20 |
+
* @return void
|
21 |
+
*/
|
22 |
+
function wpbd_render_cleanup_page(){
|
23 |
+
?>
|
24 |
+
<div class="wrap">
|
25 |
+
<h2><?php esc_html_e('Cleanup','wp-bulk-delete'); ?></h2>
|
26 |
+
<div id="poststuff">
|
27 |
+
<div id="post-body" class="metabox-holder columns-2">
|
28 |
+
|
29 |
+
<div class="notice notice-warning">
|
30 |
+
<p><strong><?php _e( 'WARNING: Before you Cleanup any data please first take Backup, any delete operation done is irreversible. Please use it with caution!', 'wp-bulk-delete' ); ?></strong></p>
|
31 |
+
</div>
|
32 |
+
|
33 |
+
<div class="delete_notice"></div>
|
34 |
+
|
35 |
+
<div id="postbox-container-1" class="postbox-container">
|
36 |
+
<?php do_action('wpbd_admin_sidebar'); ?>
|
37 |
+
</div>
|
38 |
+
|
39 |
+
<div id="postbox-container-2" class="postbox-container">
|
40 |
+
<?php
|
41 |
+
wpbd_cleanup_form( 'general' );
|
42 |
+
?>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<br class="clear">
|
46 |
+
</div>
|
47 |
+
|
48 |
+
</div><!-- /.wrap -->
|
49 |
+
<?php
|
50 |
+
}
|
includes/admin/comments/display-delete-comments.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @package WP_Bulk_Delete
|
6 |
* @subpackage Admin/Pages
|
7 |
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
-
* @since 1.0
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
@@ -17,10 +17,18 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
17 |
*
|
18 |
* Render the delete comments page contents.
|
19 |
*
|
20 |
-
* @since 1.0
|
21 |
* @return void
|
22 |
*/
|
23 |
function wpbd_delete_comments_page(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
?>
|
25 |
<div class="wrap">
|
26 |
<h2><?php esc_html_e('Delete Comments','wp-bulk-delete'); ?></h2>
|
@@ -33,15 +41,25 @@ function wpbd_delete_comments_page(){
|
|
33 |
|
34 |
<div class="delete_notice"></div>
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
</div
|
39 |
|
40 |
<div id="postbox-container-2" class="postbox-container">
|
41 |
|
42 |
-
<
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
</div>
|
46 |
</div>
|
47 |
<br class="clear">
|
5 |
* @package WP_Bulk_Delete
|
6 |
* @subpackage Admin/Pages
|
7 |
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.1.0
|
9 |
*/
|
10 |
|
11 |
// Exit if accessed directly
|
17 |
*
|
18 |
* Render the delete comments page contents.
|
19 |
*
|
20 |
+
* @since 1.1.0
|
21 |
* @return void
|
22 |
*/
|
23 |
function wpbd_delete_comments_page(){
|
24 |
+
|
25 |
+
if( ! empty( $_POST ) && isset( $_POST['_delete_comments_wpnonce'] ) ){
|
26 |
+
|
27 |
+
// Get comment_result for delete based on user input.
|
28 |
+
$comment_result = xt_delete_comments_form_process( $_POST );
|
29 |
+
wpbd_display_admin_notice( $comment_result );
|
30 |
+
|
31 |
+
}
|
32 |
?>
|
33 |
<div class="wrap">
|
34 |
<h2><?php esc_html_e('Delete Comments','wp-bulk-delete'); ?></h2>
|
41 |
|
42 |
<div class="delete_notice"></div>
|
43 |
|
44 |
+
<div id="postbox-container-1" class="postbox-container">
|
45 |
+
<?php do_action('wpbd_admin_sidebar'); ?>
|
46 |
+
</div>
|
47 |
|
48 |
<div id="postbox-container-2" class="postbox-container">
|
49 |
|
50 |
+
<form method="post" id="delete_comments_form">
|
51 |
+
<table class="form-table">
|
52 |
+
<?php do_action( 'wpbd_delete_comments_form' ); ?>
|
53 |
+
</table>
|
54 |
+
<?php
|
55 |
+
echo wp_nonce_field('delete_comments_nonce', '_delete_comments_wpnonce' );
|
56 |
+
?>
|
57 |
+
<p class="submit">
|
58 |
+
<input name="delete_comments_submit" id="delete_comments_submit" class="button button-primary" value="<?php esc_html_e('Delete Comments', 'wp-bulk-delete');?>" type="button">
|
59 |
+
<span class="spinner" style="float: none;"></span>
|
60 |
+
</p>
|
61 |
+
</form>
|
62 |
+
|
63 |
</div>
|
64 |
</div>
|
65 |
<br class="clear">
|
includes/admin/meta/display-delete-meta.php
CHANGED
@@ -24,6 +24,10 @@ function wpbd_delete_meta_page(){
|
|
24 |
?>
|
25 |
<div class="wrap">
|
26 |
<h2><?php esc_html_e('Delete Meta','wp-bulk-delete'); ?></h2>
|
|
|
|
|
|
|
|
|
27 |
<div id="poststuff">
|
28 |
<div id="post-body" class="metabox-holder columns-2">
|
29 |
|
@@ -33,20 +37,37 @@ function wpbd_delete_meta_page(){
|
|
33 |
|
34 |
<div class="delete_notice"></div>
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
</div
|
39 |
|
40 |
<div id="postbox-container-2" class="postbox-container">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
45 |
</div>
|
46 |
</div>
|
47 |
<br class="clear">
|
48 |
</div>
|
49 |
-
|
50 |
</div><!-- /.wrap -->
|
51 |
<?php
|
52 |
}
|
24 |
?>
|
25 |
<div class="wrap">
|
26 |
<h2><?php esc_html_e('Delete Meta','wp-bulk-delete'); ?></h2>
|
27 |
+
<?php
|
28 |
+
// Set Default Tab to Cleanup
|
29 |
+
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'cleanup';
|
30 |
+
?>
|
31 |
<div id="poststuff">
|
32 |
<div id="post-body" class="metabox-holder columns-2">
|
33 |
|
37 |
|
38 |
<div class="delete_notice"></div>
|
39 |
|
40 |
+
<div id="postbox-container-1" class="postbox-container">
|
41 |
+
<?php do_action('wpbd_admin_sidebar'); ?>
|
42 |
+
</div>
|
43 |
|
44 |
<div id="postbox-container-2" class="postbox-container">
|
45 |
+
<h1 class="nav-tab-wrapper" style="padding-bottom: 0px">
|
46 |
+
<a href="?page=delete_all_meta&tab=cleanup" class="nav-tab <?php echo $active_tab == 'cleanup' ? 'nav-tab-active' : ''; ?>">
|
47 |
+
<?php esc_attr_e( 'Cleanup', 'wp-bulk-delete' ); ?>
|
48 |
+
</a>
|
49 |
+
<a href="?page=delete_all_meta&tab=postmeta" class="nav-tab <?php echo $active_tab == 'postmeta' ? 'nav-tab-active' : ''; ?>">
|
50 |
+
<?php esc_attr_e( 'Post Meta', 'wp-bulk-delete' ); ?>
|
51 |
+
</a>
|
52 |
+
<a href="?page=delete_all_meta&tab=usermeta" class="nav-tab <?php echo $active_tab == 'usermeta' ? 'nav-tab-active' : ''; ?>">
|
53 |
+
<?php esc_attr_e( 'User Meta', 'wp-bulk-delete' ); ?>
|
54 |
+
</a>
|
55 |
+
<a href="?page=delete_all_meta&tab=commentmeta" class="nav-tab <?php echo $active_tab == 'commentmeta' ? 'nav-tab-active' : ''; ?>">
|
56 |
+
<?php esc_attr_e( 'Comment Meta', 'wp-bulk-delete' ); ?>
|
57 |
+
</a>
|
58 |
+
</h1>
|
59 |
|
60 |
+
<?php
|
61 |
+
if( $active_tab == 'postmeta' || $active_tab == 'usermeta' || $active_tab == 'commentmeta' ) {
|
62 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/meta/wp-bulk-delete-meta.php';
|
63 |
+
}elseif( $active_tab == 'cleanup' ){
|
64 |
+
wpbd_cleanup_form( 'meta' );
|
65 |
+
}
|
66 |
+
?>
|
67 |
</div>
|
68 |
</div>
|
69 |
<br class="clear">
|
70 |
</div>
|
|
|
71 |
</div><!-- /.wrap -->
|
72 |
<?php
|
73 |
}
|
includes/admin/meta/wp-bulk-delete-meta.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Delete Posts General Tab
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Admin/Pages
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'cleanup';
|
14 |
+
|
15 |
+
if( ! empty( $_POST ) && isset( $_POST['meta_type'] ) ){
|
16 |
+
|
17 |
+
// Get meta_result for delete based on user input.
|
18 |
+
$meta_result = wpbd_delete_meta_form_process( $_POST );
|
19 |
+
wpbd_display_admin_notice( $meta_result );
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
?>
|
24 |
+
<form method="post" id="delete_meta_form">
|
25 |
+
<table class="form-table">
|
26 |
+
<tbody>
|
27 |
+
<?php
|
28 |
+
if ( 'postmeta' == $active_tab ){
|
29 |
+
do_action( 'render_postmeta_form' );
|
30 |
+
?><input type="hidden" name="meta_type" value="postmeta" ><?php
|
31 |
+
|
32 |
+
} elseif ( 'usermeta' == $active_tab ){
|
33 |
+
do_action( 'render_usermeta_form' );
|
34 |
+
?><input type="hidden" name="meta_type" value="usermeta" ><?php
|
35 |
+
|
36 |
+
} elseif ( 'commentmeta' == $active_tab ){
|
37 |
+
do_action( 'render_commentmeta_form' );
|
38 |
+
?><input type="hidden" name="meta_type" value="commentmeta" ><?php
|
39 |
+
|
40 |
+
}
|
41 |
+
wp_nonce_field('delete_meta_nonce', '_delete_meta_wpnonce' );
|
42 |
+
?>
|
43 |
+
</tbody>
|
44 |
+
</table>
|
45 |
+
<p class="submit">
|
46 |
+
<input name="delete_meta_submit" id="delete_meta_submit" class="button button-primary" value="Delete Meta" type="button">
|
47 |
+
<span class="spinner" style="float: none;"></span>
|
48 |
+
</p>
|
49 |
+
</form>
|
50 |
+
<?php
|
51 |
+
|
includes/admin/posts/display-delete-posts.php
CHANGED
@@ -25,7 +25,7 @@ function wpbd_delete_posts_page(){
|
|
25 |
<div class="wrap">
|
26 |
<h2><?php esc_html_e('Delete Posts','wp-bulk-delete'); ?></h2>
|
27 |
<?php
|
28 |
-
// Set Default Tab to
|
29 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'cleanup';
|
30 |
?>
|
31 |
<div id="poststuff">
|
@@ -37,13 +37,13 @@ function wpbd_delete_posts_page(){
|
|
37 |
|
38 |
<div class="delete_notice"></div>
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
</div
|
43 |
|
44 |
<div id="postbox-container-2" class="postbox-container">
|
45 |
|
46 |
-
<
|
47 |
<a href="?page=delete_all_posts&tab=cleanup" class="nav-tab <?php echo $active_tab == 'cleanup' ? 'nav-tab-active' : ''; ?>">
|
48 |
<?php esc_attr_e( 'Cleanup', 'wp-bulk-delete' ); ?>
|
49 |
</a>
|
@@ -65,15 +65,15 @@ function wpbd_delete_posts_page(){
|
|
65 |
<a href="?page=delete_all_posts&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>">
|
66 |
<?php esc_attr_e( 'General (By All)', 'wp-bulk-delete' ); ?>
|
67 |
</a>
|
68 |
-
</
|
69 |
|
70 |
<?php
|
71 |
if( $active_tab == 'general' || $active_tab == 'by_taxonomy' || $active_tab == 'by_author' || $active_tab == 'by_title' || $active_tab == 'by_posttype' || $active_tab == 'by_customfield' ) {
|
72 |
// load General Post Delete Form
|
73 |
-
require_once
|
74 |
}
|
75 |
if( $active_tab == 'cleanup' ){
|
76 |
-
|
77 |
}
|
78 |
?>
|
79 |
</div>
|
25 |
<div class="wrap">
|
26 |
<h2><?php esc_html_e('Delete Posts','wp-bulk-delete'); ?></h2>
|
27 |
<?php
|
28 |
+
// Set Default Tab to Cleanup
|
29 |
$active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'cleanup';
|
30 |
?>
|
31 |
<div id="poststuff">
|
37 |
|
38 |
<div class="delete_notice"></div>
|
39 |
|
40 |
+
<div id="postbox-container-1" class="postbox-container">
|
41 |
+
<?php do_action('wpbd_admin_sidebar'); ?>
|
42 |
+
</div>
|
43 |
|
44 |
<div id="postbox-container-2" class="postbox-container">
|
45 |
|
46 |
+
<h1 class="nav-tab-wrapper" style="padding-bottom: 0px">
|
47 |
<a href="?page=delete_all_posts&tab=cleanup" class="nav-tab <?php echo $active_tab == 'cleanup' ? 'nav-tab-active' : ''; ?>">
|
48 |
<?php esc_attr_e( 'Cleanup', 'wp-bulk-delete' ); ?>
|
49 |
</a>
|
65 |
<a href="?page=delete_all_posts&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>">
|
66 |
<?php esc_attr_e( 'General (By All)', 'wp-bulk-delete' ); ?>
|
67 |
</a>
|
68 |
+
</h1>
|
69 |
|
70 |
<?php
|
71 |
if( $active_tab == 'general' || $active_tab == 'by_taxonomy' || $active_tab == 'by_author' || $active_tab == 'by_title' || $active_tab == 'by_posttype' || $active_tab == 'by_customfield' ) {
|
72 |
// load General Post Delete Form
|
73 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/posts/wp-bulk-delete-posts.php';
|
74 |
}
|
75 |
if( $active_tab == 'cleanup' ){
|
76 |
+
wpbd_cleanup_form( 'post' );
|
77 |
}
|
78 |
?>
|
79 |
</div>
|
includes/admin/posts/post-cleanup.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin Delete Posts General Tab
|
4 |
-
*
|
5 |
-
* @package WP_Bulk_Delete
|
6 |
-
* @subpackage Admin/Pages
|
7 |
-
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
-
* @since 1.0
|
9 |
-
*/
|
10 |
-
|
11 |
-
// Exit if accessed directly
|
12 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
-
|
14 |
-
if( ! empty( $_POST ) && isset( $_POST['run_post_cleanup'] ) ){
|
15 |
-
|
16 |
-
$messages = $error = array();
|
17 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
18 |
-
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
19 |
-
}
|
20 |
-
|
21 |
-
if ( isset( $_POST['_run_post_cleanup_wpnonce'] ) && wp_verify_nonce( $_POST['_run_post_cleanup_wpnonce'], 'run_post_cleanup_nonce' ) && empty( $error ) ) {
|
22 |
-
$cleanups = $_POST['cleanup_post_type'];
|
23 |
-
if( ! empty( $cleanups ) ){
|
24 |
-
foreach ($cleanups as $cleanuptype ) {
|
25 |
-
$messages[] = wpbulkdelete()->api->run_cleanup( $cleanuptype );
|
26 |
-
}
|
27 |
-
}
|
28 |
-
}else{
|
29 |
-
wp_die( esc_html__( 'Sorry, Your nonce did not verify.', 'wp-bulk-delete' ) );
|
30 |
-
}
|
31 |
-
|
32 |
-
if( !empty( $error ) ){
|
33 |
-
foreach ( $error as $err ) {
|
34 |
-
?>
|
35 |
-
<div class="notice notice-error">
|
36 |
-
<p><strong><?php echo $err; ?></strong></p>
|
37 |
-
</div>
|
38 |
-
<?php
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
if( ! empty( $messages ) ){
|
43 |
-
foreach ( $messages as $message ) {
|
44 |
-
if( $message != '' ){
|
45 |
-
?>
|
46 |
-
<div class="notice notice-success">
|
47 |
-
<p><strong><?php echo $message; ?></strong></p>
|
48 |
-
</div>
|
49 |
-
<?php
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
?>
|
55 |
-
<form method="post" id="cleanup">
|
56 |
-
<table class="form-table">
|
57 |
-
<tbody>
|
58 |
-
<?php
|
59 |
-
wpbd_render_post_cleanup();
|
60 |
-
|
61 |
-
wp_nonce_field('run_post_cleanup_nonce', '_run_post_cleanup_wpnonce' );
|
62 |
-
|
63 |
-
?>
|
64 |
-
</tbody>
|
65 |
-
</table>
|
66 |
-
<?php
|
67 |
-
submit_button( __('Run Cleanup','wp-bulk-delete'), 'primary','run_post_cleanup');
|
68 |
-
?>
|
69 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/posts/wp-bulk-delete-posts.php
CHANGED
@@ -17,30 +17,8 @@ if( ! empty( $_POST ) && isset( $_POST['delete_post_type'] ) ){
|
|
17 |
|
18 |
// Get post_result for delete based on user input.
|
19 |
$post_result = xt_delete_posts_form_process( $_POST );
|
20 |
-
|
21 |
|
22 |
-
if( !empty( $post_result['messages'] ) ){
|
23 |
-
foreach ( $post_result['messages'] as $smessages ) {
|
24 |
-
?>
|
25 |
-
<div class="notice notice-success">
|
26 |
-
<p><strong><?php echo $smessages; ?></strong></p>
|
27 |
-
</div>
|
28 |
-
<?php
|
29 |
-
}
|
30 |
-
}
|
31 |
-
} elseif ( ! empty( $post_result ) && $post_result['status'] == 0 ){
|
32 |
-
|
33 |
-
if( !empty( $post_result['messages'] ) ){
|
34 |
-
foreach ( $post_result['messages'] as $emessages ) {
|
35 |
-
?>
|
36 |
-
<div class="notice notice-error">
|
37 |
-
<p><strong><?php echo $emessages; ?></strong></p>
|
38 |
-
</div>
|
39 |
-
<?php
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
}
|
44 |
}
|
45 |
?>
|
46 |
<form method="post" id="delete_posts_form">
|
@@ -78,7 +56,7 @@ if( ! empty( $_POST ) && isset( $_POST['delete_post_type'] ) ){
|
|
78 |
</tbody>
|
79 |
</table>
|
80 |
<p class="submit">
|
81 |
-
<input name="delete_posts_submit" id="delete_posts_submit" class="button button-primary" value="Delete" type="button">
|
82 |
<span class="spinner" style="float: none;"></span>
|
83 |
</p>
|
84 |
</form>
|
17 |
|
18 |
// Get post_result for delete based on user input.
|
19 |
$post_result = xt_delete_posts_form_process( $_POST );
|
20 |
+
wpbd_display_admin_notice( $post_result );
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
?>
|
24 |
<form method="post" id="delete_posts_form">
|
56 |
</tbody>
|
57 |
</table>
|
58 |
<p class="submit">
|
59 |
+
<input name="delete_posts_submit" id="delete_posts_submit" class="button button-primary" value="Delete Posts" type="button">
|
60 |
<span class="spinner" style="float: none;"></span>
|
61 |
</p>
|
62 |
</form>
|
includes/admin/taxonomy/display-delete-taxonomy.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin Delete Taxonomy
|
4 |
-
*
|
5 |
-
* @package WP_Bulk_Delete
|
6 |
-
* @subpackage Admin/Pages
|
7 |
-
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
-
* @since 1.0
|
9 |
-
*/
|
10 |
-
|
11 |
-
// Exit if accessed directly
|
12 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
-
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Delete Taxonomy Page.
|
17 |
-
*
|
18 |
-
* Render the delete taxonomy page contents.
|
19 |
-
*
|
20 |
-
* @since 1.0
|
21 |
-
* @return void
|
22 |
-
*/
|
23 |
-
function wpbd_delete_taxonomy_page(){
|
24 |
-
?>
|
25 |
-
<div class="wrap">
|
26 |
-
<h2><?php esc_html_e('Delete Taxonomy','wp-bulk-delete'); ?></h2>
|
27 |
-
<div id="poststuff">
|
28 |
-
<div id="post-body" class="metabox-holder columns-2">
|
29 |
-
|
30 |
-
<div class="notice notice-warning">
|
31 |
-
<p><strong><?php _e( 'WARNING: Before you delete any taxonomy please first take Backup, any delete operation done is irreversible. Please use it with caution!', 'wp-bulk-delete' ); ?></strong></p>
|
32 |
-
</div>
|
33 |
-
|
34 |
-
<div class="delete_notice"></div>
|
35 |
-
|
36 |
-
<!--<div id="postbox-container-1" class="postbox-container">
|
37 |
-
|
38 |
-
</div>-->
|
39 |
-
|
40 |
-
<div id="postbox-container-2" class="postbox-container">
|
41 |
-
|
42 |
-
<h2>
|
43 |
-
<?php esc_html_e( 'Coming soon', 'wp-bulk-delete'); ?>
|
44 |
-
</h2>
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
<br class="clear">
|
48 |
-
</div>
|
49 |
-
|
50 |
-
</div><!-- /.wrap -->
|
51 |
-
<?php
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/terms/display-delete-terms.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Delete Taxonomy Terms
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Admin/Pages
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Delete Taxonomy Page.
|
17 |
+
*
|
18 |
+
* Render the delete taxonomy page contents.
|
19 |
+
*
|
20 |
+
* @since 1.0
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
function wpbd_delete_terms_page(){
|
24 |
+
|
25 |
+
if( ! empty( $_POST ) && isset( $_POST['_delete_terms_wpnonce'] ) ){
|
26 |
+
|
27 |
+
// Get terms_result for delete based on user input.
|
28 |
+
$terms_result = xt_delete_terms_form_process( $_POST );
|
29 |
+
wpbd_display_admin_notice( $terms_result );
|
30 |
+
}
|
31 |
+
?>
|
32 |
+
<div class="wrap">
|
33 |
+
<h2><?php esc_html_e('Delete Taxonomy Terms','wp-bulk-delete'); ?></h2>
|
34 |
+
<div id="poststuff">
|
35 |
+
<div id="post-body" class="metabox-holder columns-2">
|
36 |
+
|
37 |
+
<div class="notice notice-warning">
|
38 |
+
<p><strong><?php _e( 'WARNING: Before you delete any terms please first take Backup, any delete operation done is irreversible. Please use it with caution!', 'wp-bulk-delete' ); ?></strong></p>
|
39 |
+
</div>
|
40 |
+
|
41 |
+
<div class="delete_notice"></div>
|
42 |
+
|
43 |
+
<div id="postbox-container-1" class="postbox-container">
|
44 |
+
<?php do_action('wpbd_admin_sidebar'); ?>
|
45 |
+
</div>
|
46 |
+
|
47 |
+
<div id="postbox-container-2" class="postbox-container">
|
48 |
+
|
49 |
+
<form method="post" id="delete_terms_form">
|
50 |
+
<table class="form-table">
|
51 |
+
<?php do_action( 'wpbd_delete_terms_form' ); ?>
|
52 |
+
</table>
|
53 |
+
<?php
|
54 |
+
echo wp_nonce_field('delete_terms_nonce', '_delete_terms_wpnonce' );
|
55 |
+
?>
|
56 |
+
<p class="submit">
|
57 |
+
<input name="delete_terms_submit" id="delete_terms_submit" class="button button-primary" value="<?php esc_html_e('Delete Terms', 'wp-bulk-delete');?>" type="button">
|
58 |
+
<span class="spinner" style="float: none;"></span>
|
59 |
+
</p>
|
60 |
+
</form>
|
61 |
+
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
<br class="clear">
|
65 |
+
</div>
|
66 |
+
|
67 |
+
</div><!-- /.wrap -->
|
68 |
+
<?php
|
69 |
+
}
|
includes/admin/users/display-delete-users.php
CHANGED
@@ -21,6 +21,12 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
21 |
* @return void
|
22 |
*/
|
23 |
function wpbd_delete_users_page(){
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
?>
|
25 |
<div class="wrap">
|
26 |
<h2><?php esc_html_e('Delete Users','wp-bulk-delete'); ?></h2>
|
@@ -33,15 +39,24 @@ function wpbd_delete_users_page(){
|
|
33 |
|
34 |
<div class="delete_notice"></div>
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
</div
|
39 |
|
40 |
<div id="postbox-container-2" class="postbox-container">
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
</div>
|
46 |
</div>
|
47 |
<br class="clear">
|
21 |
* @return void
|
22 |
*/
|
23 |
function wpbd_delete_users_page(){
|
24 |
+
|
25 |
+
if( ! empty( $_POST ) && isset( $_POST['_delete_users_wpnonce'] ) ){
|
26 |
+
// Get user_result for delete based on user input.
|
27 |
+
$user_result = xt_delete_users_form_process( $_POST );
|
28 |
+
wpbd_display_admin_notice( $user_result );
|
29 |
+
}
|
30 |
?>
|
31 |
<div class="wrap">
|
32 |
<h2><?php esc_html_e('Delete Users','wp-bulk-delete'); ?></h2>
|
39 |
|
40 |
<div class="delete_notice"></div>
|
41 |
|
42 |
+
<div id="postbox-container-1" class="postbox-container">
|
43 |
+
<?php do_action('wpbd_admin_sidebar'); ?>
|
44 |
+
</div>
|
45 |
|
46 |
<div id="postbox-container-2" class="postbox-container">
|
47 |
+
<form method="post" id="delete_users_form">
|
48 |
+
<table class="form-table">
|
49 |
+
<?php do_action( 'wpbd_delete_users_form' );
|
50 |
+
?>
|
51 |
+
</table>
|
52 |
+
<?php
|
53 |
+
echo wp_nonce_field('delete_users_nonce', '_delete_users_wpnonce' );
|
54 |
+
?>
|
55 |
+
<p class="submit">
|
56 |
+
<input name="delete_users_submit" id="delete_users_submit" class="button button-primary" value="<?php esc_html_e('Delete Users', 'wp-bulk-delete');?>" type="button">
|
57 |
+
<span class="spinner" style="float: none;"></span>
|
58 |
+
</p>
|
59 |
+
</form>
|
60 |
</div>
|
61 |
</div>
|
62 |
<br class="clear">
|
includes/ajax-functions.php
CHANGED
@@ -13,11 +13,10 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
13 |
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
* @since 1.0
|
19 |
-
* @
|
20 |
-
* @return void
|
21 |
*/
|
22 |
function wpbd_delete_posts_count() {
|
23 |
$data = $error = $return = array();
|
@@ -118,3 +117,268 @@ function wpbd_render_terms_by_taxonomy() {
|
|
118 |
wp_die();
|
119 |
}
|
120 |
add_action( 'wp_ajax_render_terms_by_taxonomy', 'wpbd_render_terms_by_taxonomy' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
/**
|
16 |
+
* Get delete posts count for delete confirmation.
|
17 |
*
|
18 |
* @since 1.0
|
19 |
+
* @return array
|
|
|
20 |
*/
|
21 |
function wpbd_delete_posts_count() {
|
22 |
$data = $error = $return = array();
|
117 |
wp_die();
|
118 |
}
|
119 |
add_action( 'wp_ajax_render_terms_by_taxonomy', 'wpbd_render_terms_by_taxonomy' );
|
120 |
+
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Delete Users count for delete confirmation.
|
124 |
+
*
|
125 |
+
* @since 1.1.0
|
126 |
+
* @return array
|
127 |
+
*/
|
128 |
+
function wpbd_delete_users_count() {
|
129 |
+
$data = $error = $return = array();
|
130 |
+
parse_str($_POST['form'], $data);
|
131 |
+
if( ! empty( $data ) ){
|
132 |
+
|
133 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
134 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
135 |
+
}
|
136 |
+
|
137 |
+
if ( isset( $data['_delete_users_wpnonce'] ) && wp_verify_nonce( $data['_delete_users_wpnonce'], 'delete_users_nonce' ) ) {
|
138 |
+
|
139 |
+
if( empty( $error ) ){
|
140 |
+
|
141 |
+
// Get post_ids for delete based on user input.
|
142 |
+
$post_ids = wpbulkdelete()->api->get_delete_user_ids( $data );
|
143 |
+
|
144 |
+
if ( ! empty( $post_ids ) && count( $post_ids ) > 0 ) {
|
145 |
+
$return = array(
|
146 |
+
'status' => 1,
|
147 |
+
'post_count' => count( $post_ids ),
|
148 |
+
);
|
149 |
+
} else {
|
150 |
+
$return = array(
|
151 |
+
'status' => 2,
|
152 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
153 |
+
);
|
154 |
+
}
|
155 |
+
|
156 |
+
} else {
|
157 |
+
$return = array(
|
158 |
+
'status' => 0,
|
159 |
+
'messages' => $error[0],
|
160 |
+
);
|
161 |
+
}
|
162 |
+
|
163 |
+
} else {
|
164 |
+
$error[] = esc_html__('Sorry, Your nonce did not verify.', 'wp-bulk-delete' );
|
165 |
+
$return = array(
|
166 |
+
'status' => 0,
|
167 |
+
'messages' => $error[0],
|
168 |
+
);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
echo json_encode( $return );
|
172 |
+
wp_die(); // this is required to terminate immediately and return a proper response
|
173 |
+
}
|
174 |
+
add_action( 'wp_ajax_delete_users_count', 'wpbd_delete_users_count' );
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Delete comments count for delete confirmation.
|
178 |
+
*
|
179 |
+
* @since 1.1.0
|
180 |
+
* @return array
|
181 |
+
*/
|
182 |
+
function wpbd_delete_comments_count() {
|
183 |
+
$data = $error = $return = array();
|
184 |
+
parse_str($_POST['form'], $data);
|
185 |
+
if( ! empty( $data ) ){
|
186 |
+
|
187 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
188 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
189 |
+
}
|
190 |
+
|
191 |
+
if( empty( $data['delete_comment_status'] ) ){
|
192 |
+
$error[] = esc_html__('Please select Comment status for proceed delete operation.', 'wp-bulk-delete' );
|
193 |
+
}
|
194 |
+
|
195 |
+
if ( isset( $data['_delete_comments_wpnonce'] ) && wp_verify_nonce( $data['_delete_comments_wpnonce'], 'delete_comments_nonce' ) ) {
|
196 |
+
|
197 |
+
if( empty( $error ) ){
|
198 |
+
|
199 |
+
// Get delete comment count based on form data
|
200 |
+
$deletecomment_count = wpbulkdelete()->api->get_delete_comment_count( $data );
|
201 |
+
|
202 |
+
if( false === $deletecomment_count ){
|
203 |
+
$return = array(
|
204 |
+
'status' => 0,
|
205 |
+
'messages' => array( esc_html__( 'Something went wrong pelase try again!!', 'wp-bulk-delete' ) ),
|
206 |
+
);
|
207 |
+
}
|
208 |
+
|
209 |
+
if ( $deletecomment_count > 0 ) {
|
210 |
+
$return = array(
|
211 |
+
'status' => 1,
|
212 |
+
'post_count' => $deletecomment_count,
|
213 |
+
);
|
214 |
+
} else {
|
215 |
+
$return = array(
|
216 |
+
'status' => 2,
|
217 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
218 |
+
);
|
219 |
+
}
|
220 |
+
|
221 |
+
} else {
|
222 |
+
$return = array(
|
223 |
+
'status' => 0,
|
224 |
+
'messages' => $error[0],
|
225 |
+
);
|
226 |
+
}
|
227 |
+
|
228 |
+
} else {
|
229 |
+
$error[] = esc_html__('Sorry, Your nonce did not verify.', 'wp-bulk-delete' );
|
230 |
+
$return = array(
|
231 |
+
'status' => 0,
|
232 |
+
'messages' => $error[0],
|
233 |
+
);
|
234 |
+
}
|
235 |
+
}
|
236 |
+
echo json_encode( $return );
|
237 |
+
wp_die(); // this is required to terminate immediately and return a proper response
|
238 |
+
}
|
239 |
+
add_action( 'wp_ajax_delete_comments_count', 'wpbd_delete_comments_count' );
|
240 |
+
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Get delete meta count for delete confirmation.
|
244 |
+
*
|
245 |
+
* @since 1.0
|
246 |
+
* @return array
|
247 |
+
*/
|
248 |
+
function wpbd_delete_meta_count() {
|
249 |
+
$data = $error = $return = array();
|
250 |
+
parse_str($_POST['form'], $data);
|
251 |
+
if( ! empty( $data ) ){
|
252 |
+
|
253 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
254 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
255 |
+
}
|
256 |
+
|
257 |
+
if( $data['custom_field_key'] == '' ){
|
258 |
+
$error[] = esc_html__('Please select all required fields.', 'wp-bulk-delete' );
|
259 |
+
}
|
260 |
+
|
261 |
+
if( $data['meta_type'] == 'postmeta' ){
|
262 |
+
if( $data['meta_post_type'] == '' ){
|
263 |
+
$error[] = esc_html__('Please select all required fields.', 'wp-bulk-delete' );
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
if( $data['meta_type'] == 'usermeta' ){
|
268 |
+
if( empty( $data['delete_user_roles'] ) ){
|
269 |
+
$error[] = esc_html__('Please select all required fields.', 'wp-bulk-delete' );
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
if ( isset( $data['_delete_meta_wpnonce'] ) && wp_verify_nonce( $data['_delete_meta_wpnonce'], 'delete_meta_nonce' ) ) {
|
274 |
+
|
275 |
+
if( empty( $error ) ){
|
276 |
+
// Get meta_ids for delete based on user input.
|
277 |
+
$meta_ids = array();
|
278 |
+
if( 'postmeta' == $data['meta_type'] ) {
|
279 |
+
$meta_ids = wpbulkdelete()->api->get_delete_postmeta_ids( $data );
|
280 |
+
|
281 |
+
} elseif('usermeta' == $data['meta_type'] ) {
|
282 |
+
$meta_ids = wpbulkdelete()->api->get_delete_usermeta_ids( $data );
|
283 |
+
|
284 |
+
} elseif('commentmeta' == $data['meta_type'] ) {
|
285 |
+
$meta_ids = wpbulkdelete()->api->get_delete_commentmeta_ids( $data );
|
286 |
+
}
|
287 |
+
|
288 |
+
if ( ! empty( $meta_ids ) && count( $meta_ids ) > 0 ) {
|
289 |
+
$return = array(
|
290 |
+
'status' => 1,
|
291 |
+
'post_count' => count( $meta_ids ),
|
292 |
+
);
|
293 |
+
} else {
|
294 |
+
$return = array(
|
295 |
+
'status' => 2,
|
296 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
297 |
+
);
|
298 |
+
}
|
299 |
+
|
300 |
+
} else {
|
301 |
+
$return = array(
|
302 |
+
'status' => 0,
|
303 |
+
'messages' => $error[0],
|
304 |
+
);
|
305 |
+
}
|
306 |
+
|
307 |
+
} else {
|
308 |
+
$error[] = esc_html__('Sorry, Your nonce did not verify.', 'wp-bulk-delete' );
|
309 |
+
$return = array(
|
310 |
+
'status' => 0,
|
311 |
+
'messages' => $error[0],
|
312 |
+
);
|
313 |
+
}
|
314 |
+
}
|
315 |
+
echo json_encode( $return );
|
316 |
+
wp_die(); // this is required to terminate immediately and return a proper response
|
317 |
+
}
|
318 |
+
add_action( 'wp_ajax_delete_meta_count', 'wpbd_delete_meta_count' );
|
319 |
+
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Delete comments count for delete confirmation.
|
323 |
+
*
|
324 |
+
* @since 1.1.0
|
325 |
+
* @return array
|
326 |
+
*/
|
327 |
+
function wpbd_delete_terms_count() {
|
328 |
+
$data = $error = $return = array();
|
329 |
+
parse_str($_POST['form'], $data);
|
330 |
+
if( ! empty( $data ) ){
|
331 |
+
|
332 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
333 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
334 |
+
}
|
335 |
+
|
336 |
+
if( $data['delete_post_type'] == '' || $data['post_taxonomy'] == '' ){
|
337 |
+
$error[] = esc_html__('Please select required fields for proceed delete operation.', 'wp-bulk-delete' );
|
338 |
+
}
|
339 |
+
|
340 |
+
if ( isset( $data['_delete_terms_wpnonce'] ) && wp_verify_nonce( $data['_delete_terms_wpnonce'], 'delete_terms_nonce' ) ) {
|
341 |
+
|
342 |
+
if( empty( $error ) ){
|
343 |
+
|
344 |
+
// Get delete comment count based on form data
|
345 |
+
$deleteterms_count = wpbulkdelete()->api->get_delete_term_count( $data );
|
346 |
+
|
347 |
+
if( false === $deleteterms_count ){
|
348 |
+
$return = array(
|
349 |
+
'status' => 0,
|
350 |
+
'messages' => array( esc_html__( 'Something went wrong pelase try again!!', 'wp-bulk-delete' ) ),
|
351 |
+
);
|
352 |
+
}
|
353 |
+
|
354 |
+
if ( $deleteterms_count > 0 ) {
|
355 |
+
$return = array(
|
356 |
+
'status' => 1,
|
357 |
+
'post_count' => $deleteterms_count,
|
358 |
+
);
|
359 |
+
} else {
|
360 |
+
$return = array(
|
361 |
+
'status' => 2,
|
362 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
363 |
+
);
|
364 |
+
}
|
365 |
+
|
366 |
+
} else {
|
367 |
+
$return = array(
|
368 |
+
'status' => 0,
|
369 |
+
'messages' => $error[0],
|
370 |
+
);
|
371 |
+
}
|
372 |
+
|
373 |
+
} else {
|
374 |
+
$error[] = esc_html__('Sorry, Your nonce did not verify.', 'wp-bulk-delete' );
|
375 |
+
$return = array(
|
376 |
+
'status' => 0,
|
377 |
+
'messages' => $error[0],
|
378 |
+
);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
echo json_encode( $return );
|
382 |
+
wp_die(); // this is required to terminate immediately and return a proper response
|
383 |
+
}
|
384 |
+
add_action( 'wp_ajax_delete_terms_count', 'wpbd_delete_terms_count' );
|
includes/class-delete-api.php
CHANGED
@@ -46,13 +46,17 @@ class WPBD_Delete_API {
|
|
46 |
$post_status = ( $data['delete_post_status'] ) ? array_map('esc_sql', $data['delete_post_status'] ) : array();
|
47 |
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
48 |
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
49 |
-
$delete_authors = ( $data['delete_authors'] ) ? array_map( 'intval', $data['delete_authors'] ) : array();
|
50 |
$delete_type = ( $data['delete_type'] )?$data['delete_type']:'trash';
|
51 |
$limit_post = ( $data['limit_post'] ) ? absint( $data['limit_post'] ) : '';
|
52 |
|
53 |
// BY Taxonomy.
|
54 |
-
$post_taxonomy = ( $data['post_taxonomy'] ) ? esc_sql( $data['post_taxonomy'] ) : '';
|
55 |
-
$post_taxonomy_terms = ( $data['post_taxonomy_terms'] ) ? array_map( 'intval', $data['post_taxonomy_terms'] ) : array();
|
|
|
|
|
|
|
|
|
56 |
|
57 |
// Query Generation.
|
58 |
$query = "SELECT DISTINCT $wpdb->posts.ID FROM $wpdb->posts ";
|
@@ -144,9 +148,85 @@ class WPBD_Delete_API {
|
|
144 |
case 'trash':
|
145 |
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = %s", 'trash' ) );
|
146 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
return $count;
|
|
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
152 |
|
@@ -170,7 +250,7 @@ class WPBD_Delete_API {
|
|
170 |
wp_delete_post_revision( intval( $id ) );
|
171 |
}
|
172 |
|
173 |
-
$message = sprintf( __( '%s Revisions Cleaned up', 'wp-
|
174 |
}
|
175 |
break;
|
176 |
case 'auto_drafts':
|
@@ -180,7 +260,7 @@ class WPBD_Delete_API {
|
|
180 |
wp_delete_post( intval( $id ), true );
|
181 |
}
|
182 |
|
183 |
-
$message = sprintf( __( '%s Auto Drafts Cleaned up', 'wp-
|
184 |
}
|
185 |
break;
|
186 |
case 'trash':
|
@@ -190,12 +270,791 @@ class WPBD_Delete_API {
|
|
190 |
wp_delete_post( $id, true );
|
191 |
}
|
192 |
|
193 |
-
$message = sprintf( __( '%s Trashed Posts Cleaned up', 'wp-
|
194 |
}
|
195 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
return $message;
|
198 |
}
|
199 |
-
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
$post_status = ( $data['delete_post_status'] ) ? array_map('esc_sql', $data['delete_post_status'] ) : array();
|
47 |
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
48 |
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
49 |
+
$delete_authors = isset( $data['delete_authors'] ) ? array_map( 'intval', $data['delete_authors'] ) : array();
|
50 |
$delete_type = ( $data['delete_type'] )?$data['delete_type']:'trash';
|
51 |
$limit_post = ( $data['limit_post'] ) ? absint( $data['limit_post'] ) : '';
|
52 |
|
53 |
// BY Taxonomy.
|
54 |
+
$post_taxonomy = isset( $data['post_taxonomy'] ) ? esc_sql( $data['post_taxonomy'] ) : '';
|
55 |
+
$post_taxonomy_terms = isset( $data['post_taxonomy_terms'] ) ? array_map( 'intval', $data['post_taxonomy_terms'] ) : array();
|
56 |
+
|
57 |
+
if( empty( $post_types ) || empty( $post_status ) ){
|
58 |
+
return array();
|
59 |
+
}
|
60 |
|
61 |
// Query Generation.
|
62 |
$query = "SELECT DISTINCT $wpdb->posts.ID FROM $wpdb->posts ";
|
148 |
case 'trash':
|
149 |
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = %s", 'trash' ) );
|
150 |
break;
|
151 |
+
case 'orphan_postmeta':
|
152 |
+
$count = $wpdb->get_var( "SELECT COUNT(meta_id) FROM $wpdb->postmeta WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)" );
|
153 |
+
break;
|
154 |
+
case 'orphan_commentmeta':
|
155 |
+
$count = $wpdb->get_var( "SELECT COUNT(meta_id) FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_ID FROM $wpdb->comments)" );
|
156 |
+
break;
|
157 |
+
case 'orphan_usermeta':
|
158 |
+
$count = $wpdb->get_var( "SELECT COUNT(umeta_id) FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)" );
|
159 |
+
break;
|
160 |
+
case 'orphan_termmeta':
|
161 |
+
$count = $wpdb->get_var( "SELECT COUNT(meta_id) FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)" );
|
162 |
+
break;
|
163 |
+
|
164 |
+
case 'duplicated_postmeta':
|
165 |
+
$query = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT(meta_id) AS count FROM $wpdb->postmeta GROUP BY post_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
166 |
+
if( is_array( $query ) ) {
|
167 |
+
$count = array_sum( array_map( 'intval', $query ) );
|
168 |
+
}
|
169 |
+
break;
|
170 |
+
case 'duplicated_commentmeta':
|
171 |
+
$query = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT(meta_id) AS count FROM $wpdb->commentmeta GROUP BY comment_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
172 |
+
if( is_array( $query ) ) {
|
173 |
+
$count = array_sum( array_map( 'intval', $query ) );
|
174 |
+
}
|
175 |
+
break;
|
176 |
+
case 'duplicated_usermeta':
|
177 |
+
$query = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT(umeta_id) AS count FROM $wpdb->usermeta GROUP BY user_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
178 |
+
if( is_array( $query ) ) {
|
179 |
+
$count = array_sum( array_map( 'intval', $query ) );
|
180 |
+
}
|
181 |
+
break;
|
182 |
+
case 'duplicated_termmeta':
|
183 |
+
$query = $wpdb->get_col( $wpdb->prepare( "SELECT COUNT(meta_id) AS count FROM $wpdb->termmeta GROUP BY term_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
184 |
+
if( is_array( $query ) ) {
|
185 |
+
$count = array_sum( array_map( 'intval', $query ) );
|
186 |
+
}
|
187 |
+
break;
|
188 |
+
|
189 |
}
|
190 |
return $count;
|
191 |
+
}
|
192 |
|
193 |
+
/**
|
194 |
+
* Get Comment Count by status
|
195 |
+
*
|
196 |
+
* @access public
|
197 |
+
* @since 1.0
|
198 |
+
* @param array $status status
|
199 |
+
* @return int | posts count.
|
200 |
+
*/
|
201 |
+
public function get_comment_count( $status = '' ) {
|
202 |
+
global $wpdb;
|
203 |
+
|
204 |
+
$count = 0;
|
205 |
+
|
206 |
+
switch( $status ) {
|
207 |
+
|
208 |
+
case 'pending':
|
209 |
+
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = %s", '0' ) );
|
210 |
+
break;
|
211 |
+
|
212 |
+
case 'spam':
|
213 |
+
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = %s", 'spam' ) );
|
214 |
+
break;
|
215 |
+
|
216 |
+
case 'trash':
|
217 |
+
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE (comment_approved = %s OR comment_approved = %s)", 'trash', 'post-trashed' ) );
|
218 |
+
break;
|
219 |
+
|
220 |
+
case 'approved':
|
221 |
+
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = %s", '1' ) );
|
222 |
+
break;
|
223 |
+
|
224 |
+
default:
|
225 |
+
$count = 0;
|
226 |
+
break;
|
227 |
+
}
|
228 |
+
|
229 |
+
return $count;
|
230 |
}
|
231 |
|
232 |
|
250 |
wp_delete_post_revision( intval( $id ) );
|
251 |
}
|
252 |
|
253 |
+
$message = sprintf( __( '%s Revisions Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $posts ) ) );
|
254 |
}
|
255 |
break;
|
256 |
case 'auto_drafts':
|
260 |
wp_delete_post( intval( $id ), true );
|
261 |
}
|
262 |
|
263 |
+
$message = sprintf( __( '%s Auto Drafts Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $posts ) ) );
|
264 |
}
|
265 |
break;
|
266 |
case 'trash':
|
270 |
wp_delete_post( $id, true );
|
271 |
}
|
272 |
|
273 |
+
$message = sprintf( __( '%s Trashed Posts Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $posts ) ) );
|
274 |
}
|
275 |
break;
|
276 |
+
|
277 |
+
case 'orphan_postmeta':
|
278 |
+
$query = $wpdb->get_results( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)" );
|
279 |
+
if( $query ) {
|
280 |
+
foreach ( $query as $meta ) {
|
281 |
+
$post_id = intval( $meta->post_id );
|
282 |
+
if( $post_id === 0 ) {
|
283 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta->meta_key ) );
|
284 |
+
} else {
|
285 |
+
delete_post_meta( $post_id, $meta->meta_key );
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
$message = sprintf( __( '%s Orphaned Post Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
290 |
+
}
|
291 |
+
break;
|
292 |
+
case 'orphan_commentmeta':
|
293 |
+
$query = $wpdb->get_results( "SELECT comment_id, meta_key FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_ID FROM $wpdb->comments)" );
|
294 |
+
if( $query ) {
|
295 |
+
foreach ( $query as $meta ) {
|
296 |
+
$comment_id = intval( $meta->comment_id );
|
297 |
+
if( $comment_id === 0 ) {
|
298 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->commentmeta WHERE comment_id = %d AND meta_key = %s", $comment_id, $meta->meta_key ) );
|
299 |
+
} else {
|
300 |
+
delete_comment_meta( $comment_id, $meta->meta_key );
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
$message = sprintf( __( '%s Orphaned Comment Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
305 |
+
}
|
306 |
+
break;
|
307 |
+
case 'orphan_usermeta':
|
308 |
+
$query = $wpdb->get_results( "SELECT user_id, meta_key FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)" );
|
309 |
+
if( $query ) {
|
310 |
+
foreach ( $query as $meta ) {
|
311 |
+
$user_id = intval( $meta->user_id );
|
312 |
+
if( $user_id === 0 ) {
|
313 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta->meta_key ) );
|
314 |
+
} else {
|
315 |
+
delete_user_meta( $user_id, $meta->meta_key );
|
316 |
+
}
|
317 |
+
}
|
318 |
+
|
319 |
+
$message = sprintf( __( '%s Orphaned User Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
320 |
+
}
|
321 |
+
break;
|
322 |
+
case 'orphan_termmeta':
|
323 |
+
$query = $wpdb->get_results( "SELECT term_id, meta_key FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)" );
|
324 |
+
if( $query ) {
|
325 |
+
foreach ( $query as $meta ) {
|
326 |
+
$term_id = intval( $meta->term_id );
|
327 |
+
if( $term_id === 0 ) {
|
328 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->termmeta WHERE term_id = %d AND meta_key = %s", $term_id, $meta->meta_key ) );
|
329 |
+
} else {
|
330 |
+
delete_term_meta( $term_id, $meta->meta_key );
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
$message = sprintf( __( '%s Orphaned Term Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
335 |
+
}
|
336 |
+
break;
|
337 |
+
|
338 |
+
case 'duplicated_postmeta':
|
339 |
+
$query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS ids, post_id, COUNT(*) AS count FROM $wpdb->postmeta GROUP BY post_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
340 |
+
if( $query ) {
|
341 |
+
foreach ( $query as $meta ) {
|
342 |
+
$ids = array_map( 'intval', explode( ',', $meta->ids ) );
|
343 |
+
array_pop( $ids );
|
344 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_id IN (" . implode( ',', $ids ) . ") AND post_id = %d", intval( $meta->post_id ) ) );
|
345 |
+
}
|
346 |
+
|
347 |
+
$message = sprintf( __( '%s Duplicated Post Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
348 |
+
}
|
349 |
+
break;
|
350 |
+
case 'duplicated_commentmeta':
|
351 |
+
$query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS ids, comment_id, COUNT(*) AS count FROM $wpdb->commentmeta GROUP BY comment_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
352 |
+
if( $query ) {
|
353 |
+
foreach ( $query as $meta ) {
|
354 |
+
$ids = array_map( 'intval', explode( ',', $meta->ids ) );
|
355 |
+
array_pop( $ids );
|
356 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->commentmeta WHERE meta_id IN (" . implode( ',', $ids ) . ") AND comment_id = %d", intval( $meta->comment_id ) ) );
|
357 |
+
}
|
358 |
+
|
359 |
+
$message = sprintf( __( '%s Duplicated Comment Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
360 |
+
}
|
361 |
+
break;
|
362 |
+
case 'duplicated_usermeta':
|
363 |
+
$query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(umeta_id ORDER BY umeta_id DESC) AS ids, user_id, COUNT(*) AS count FROM $wpdb->usermeta GROUP BY user_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
364 |
+
if( $query ) {
|
365 |
+
foreach ( $query as $meta ) {
|
366 |
+
$ids = array_map( 'intval', explode( ',', $meta->ids ) );
|
367 |
+
array_pop( $ids );
|
368 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE umeta_id IN (" . implode( ',', $ids ) . ") AND user_id = %d", intval( $meta->user_id ) ) );
|
369 |
+
}
|
370 |
+
|
371 |
+
$message = sprintf( __( '%s Duplicated User Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
372 |
+
}
|
373 |
+
break;
|
374 |
+
case 'duplicated_termmeta':
|
375 |
+
$query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS ids, term_id, COUNT(*) AS count FROM $wpdb->termmeta GROUP BY term_id, meta_key, meta_value HAVING count > %d", 1 ) );
|
376 |
+
if( $query ) {
|
377 |
+
foreach ( $query as $meta ) {
|
378 |
+
$ids = array_map( 'intval', explode( ',', $meta->ids ) );
|
379 |
+
array_pop( $ids );
|
380 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->termmeta WHERE meta_id IN (" . implode( ',', $ids ) . ") AND term_id = %d", intval( $meta->term_id ) ) );
|
381 |
+
}
|
382 |
+
|
383 |
+
$message = sprintf( __( '%s Duplicated Term Meta Cleaned up', 'wp-bulk-delete' ), number_format_i18n( sizeof( $query ) ) );
|
384 |
+
}
|
385 |
+
break;
|
386 |
+
|
387 |
}
|
388 |
return $message;
|
389 |
}
|
|
|
390 |
|
391 |
+
/**
|
392 |
+
* Get Users Ids.
|
393 |
+
*
|
394 |
+
* @access public
|
395 |
+
* @since 1.0
|
396 |
+
* @param array $data Delete User form data.
|
397 |
+
* @return array | Users Id.
|
398 |
+
*/
|
399 |
+
public function get_delete_user_ids( $data = array() ){
|
400 |
+
global $wpdb;
|
401 |
+
|
402 |
+
if( empty( $data['delete_user_roles'] ) && ( $data['user_meta_key'] == '' || $data['user_meta_value'] == '' ) ){
|
403 |
+
return array();
|
404 |
+
}
|
405 |
+
$delete_user_roles = ( $data['delete_user_roles'] ) ? $data['delete_user_roles'] : array();
|
406 |
+
$delete_user_roles = array_map('esc_sql', $delete_user_roles );
|
407 |
+
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
408 |
+
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
409 |
+
$limit_user = isset( $data['limit_user'] ) ? absint( $data['limit_user'] ) : '';
|
410 |
+
|
411 |
+
// By Usermeta.
|
412 |
+
$user_meta_key = ( $data['user_meta_key'] ) ? esc_sql( $data['user_meta_key'] ) : '';
|
413 |
+
$user_meta_value = ( $data['user_meta_value'] ) ? esc_sql( $data['user_meta_value'] ) : '';
|
414 |
+
$user_meta_compare = ( $data['user_meta_compare'] ) ? $data['user_meta_compare'] : 'equal_to_str';
|
415 |
+
|
416 |
+
// Query Generation.
|
417 |
+
$query = "SELECT DISTINCT $wpdb->users.ID FROM $wpdb->users ";
|
418 |
+
|
419 |
+
if ( $user_meta_key != '' && $user_meta_compare != '' && $user_meta_value != '' ) {
|
420 |
+
$query .= " INNER JOIN $wpdb->usermeta ON( $wpdb->users.ID = $wpdb->usermeta.user_id )";
|
421 |
+
}
|
422 |
+
|
423 |
+
if( !empty( $delete_user_roles ) ){
|
424 |
+
$i = 1;
|
425 |
+
foreach ($delete_user_roles as $delete_user_role ) {
|
426 |
+
$query .= " INNER JOIN $wpdb->usermeta AS mt{$i} ON ( $wpdb->users.ID = mt{$i}.user_id )";
|
427 |
+
$i++;
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
$query .= ' WHERE 1=1 ';
|
432 |
+
|
433 |
+
if ( $user_meta_key != '' && $user_meta_compare != '' && $user_meta_value != '' ) {
|
434 |
+
$query .= " AND ( $wpdb->usermeta.meta_key = '" . $user_meta_key. "'";
|
435 |
+
switch ( $user_meta_compare ) {
|
436 |
+
case 'equal_to_str':
|
437 |
+
$query .= " AND $wpdb->usermeta.meta_value = '{$user_meta_value}' )";
|
438 |
+
break;
|
439 |
+
|
440 |
+
case 'notequal_to_str':
|
441 |
+
$query .= " AND $wpdb->usermeta.meta_value != '{$user_meta_value}' )";
|
442 |
+
break;
|
443 |
+
|
444 |
+
case 'like_str':
|
445 |
+
$query .= " AND $wpdb->usermeta.meta_value LIKE '%{$user_meta_value}%' )";
|
446 |
+
break;
|
447 |
+
|
448 |
+
case 'notlike_str':
|
449 |
+
$query .= " AND $wpdb->usermeta.meta_value NOT LIKE '%{$user_meta_value}%' )";
|
450 |
+
break;
|
451 |
+
|
452 |
+
case 'equal_to_date':
|
453 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS DATE) = '{$user_meta_value}' )";
|
454 |
+
break;
|
455 |
+
|
456 |
+
case 'notequal_to_date':
|
457 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS DATE) != '{$user_meta_value}' )";
|
458 |
+
break;
|
459 |
+
|
460 |
+
case 'lessthen_date':
|
461 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS DATE) < '{$user_meta_value}' )";
|
462 |
+
break;
|
463 |
+
|
464 |
+
case 'lessthenequal_date':
|
465 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS DATE) <= '{$user_meta_value}' )";
|
466 |
+
break;
|
467 |
+
|
468 |
+
case 'greaterthen_date':
|
469 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS DATE) > '{$user_meta_value}' )";
|
470 |
+
break;
|
471 |
+
|
472 |
+
case 'greaterthenequal_date':
|
473 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS DATE) >= '{$user_meta_value}' )";
|
474 |
+
break;
|
475 |
+
|
476 |
+
case 'equal_to_number':
|
477 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS SIGNED) = '{$user_meta_value}' )";
|
478 |
+
break;
|
479 |
+
|
480 |
+
case 'notequal_to_number':
|
481 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS SIGNED) != '{$user_meta_value}' )";
|
482 |
+
break;
|
483 |
+
|
484 |
+
case 'lessthen_number':
|
485 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS SIGNED) < '{$user_meta_value}' )";
|
486 |
+
break;
|
487 |
+
|
488 |
+
case 'lessthenequal_number':
|
489 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS SIGNED) <= '{$user_meta_value}' )";
|
490 |
+
break;
|
491 |
+
|
492 |
+
case 'greaterthen_number':
|
493 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS SIGNED) > '{$user_meta_value}' )";
|
494 |
+
break;
|
495 |
+
|
496 |
+
case 'greaterthenequal_number':
|
497 |
+
$query .= " AND CAST($wpdb->usermeta.meta_value AS SIGNED) >= '{$user_meta_value}' )";
|
498 |
+
break;
|
499 |
+
|
500 |
+
default:
|
501 |
+
$query .= " AND $wpdb->usermeta.meta_value = '{$user_meta_value}' )";
|
502 |
+
break;
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
if( !empty( $delete_user_roles ) ){
|
507 |
+
$j = 1;
|
508 |
+
$subquery = array();
|
509 |
+
foreach ($delete_user_roles as $delete_user_role ) {
|
510 |
+
$subquery[]= "( mt{$j}.meta_key = '{$wpdb->prefix}capabilities' AND mt{$j}.meta_value LIKE '%\"{$delete_user_role}\"%' )";
|
511 |
+
$j++;
|
512 |
+
}
|
513 |
+
$subquery = implode( ' OR ', $subquery );
|
514 |
+
$query .= " AND ( {$subquery} )";
|
515 |
+
}
|
516 |
+
|
517 |
+
if( $delete_start_date != ''){
|
518 |
+
$query .= " AND ( $wpdb->users.user_registered >= '{$delete_start_date} 00:00:00' )";
|
519 |
+
}
|
520 |
+
if( $delete_end_date != ''){
|
521 |
+
$query .= " AND ( $wpdb->users.user_registered <= '{$delete_end_date} 23:59:59' )";
|
522 |
+
}
|
523 |
+
|
524 |
+
$query .= " AND $wpdb->users.ID NOT IN ( ".get_current_user_id()." )";
|
525 |
+
|
526 |
+
if( $limit_user != '' ){
|
527 |
+
if( is_numeric( $limit_user ) ){
|
528 |
+
$query .= " ORDER BY $wpdb->users.user_login ASC LIMIT " . $limit_user;
|
529 |
+
}
|
530 |
+
}
|
531 |
+
$users = $wpdb->get_col( $query );
|
532 |
+
return $users;
|
533 |
+
}
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Do Delete operation on users.
|
537 |
+
*
|
538 |
+
* @access public
|
539 |
+
* @since 1.0
|
540 |
+
* @param array $data Posts Id.
|
541 |
+
* @return array | deleted posts count.
|
542 |
+
*/
|
543 |
+
public function do_delete_users( $user_ids = array(), $reassign_user = '') {
|
544 |
+
$user_delete_count = 0;
|
545 |
+
require_once(ABSPATH.'wp-admin/includes/user.php' );
|
546 |
+
$current_user = wp_get_current_user();
|
547 |
+
$user_ids = array_diff( $user_ids, array( $current_user->ID ) );
|
548 |
+
if ( ! empty( $user_ids ) ){
|
549 |
+
foreach ($user_ids as $user_id ) {
|
550 |
+
if( $reassign_user != '' && $reassign_user > 0 ){
|
551 |
+
wp_delete_user( $user_id , $reassign_user );
|
552 |
+
}else{
|
553 |
+
wp_delete_user( $user_id );
|
554 |
+
}
|
555 |
+
|
556 |
+
}
|
557 |
+
$user_delete_count = count( $user_ids );
|
558 |
+
|
559 |
+
}
|
560 |
+
return $user_delete_count;
|
561 |
+
}
|
562 |
+
|
563 |
+
/**
|
564 |
+
* Get Comment count to be deleted.
|
565 |
+
*
|
566 |
+
* @access public
|
567 |
+
* @since 1.1.0
|
568 |
+
* @param array $data Delete comment form data.
|
569 |
+
* @return comment count.
|
570 |
+
*/
|
571 |
+
public function get_delete_comment_count( $data = array() ){
|
572 |
+
global $wpdb;
|
573 |
+
$comment_delete_count = 0;
|
574 |
+
$delete_comment_status = ( $data['delete_comment_status'] ) ? $data['delete_comment_status'] : array();
|
575 |
+
$delete_comment_status = array_map('esc_sql', $delete_comment_status );
|
576 |
+
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
577 |
+
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
578 |
+
|
579 |
+
if ( ! empty( $data ) ){
|
580 |
+
|
581 |
+
$temp_delete_query = array();
|
582 |
+
|
583 |
+
if( ! empty( $delete_comment_status ) ){
|
584 |
+
foreach ( $delete_comment_status as $comment_status ) {
|
585 |
+
|
586 |
+
switch( $comment_status ) {
|
587 |
+
case 'pending':
|
588 |
+
$temp_delete_query[] = "comment_approved = '0'";
|
589 |
+
break;
|
590 |
+
|
591 |
+
case 'spam':
|
592 |
+
$temp_delete_query[] = "comment_approved = 'spam'";
|
593 |
+
break;
|
594 |
+
|
595 |
+
case 'trash':
|
596 |
+
$temp_delete_query[] = "comment_approved = 'trash' OR comment_approved = 'post-trashed'";
|
597 |
+
break;
|
598 |
+
|
599 |
+
case 'approved':
|
600 |
+
$temp_delete_query[] = "comment_approved = '1'";
|
601 |
+
break;
|
602 |
+
}
|
603 |
+
|
604 |
+
}
|
605 |
+
if( !empty( $temp_delete_query ) ) {
|
606 |
+
$delete_comment_query = "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE 1=1";
|
607 |
+
$delete_comment_query .= " AND (" . implode( " OR ", $temp_delete_query ) . ")";
|
608 |
+
}
|
609 |
+
}
|
610 |
+
|
611 |
+
if( $delete_start_date != ''){
|
612 |
+
$delete_comment_query .= " AND ( comment_date >= '{$delete_start_date} 00:00:00' )";
|
613 |
+
}
|
614 |
+
if( $delete_end_date != ''){
|
615 |
+
$delete_comment_query .= " AND ( comment_date <= '{$delete_end_date} 23:59:59' )";
|
616 |
+
}
|
617 |
+
$comment_delete_count = $wpdb->get_var( $delete_comment_query );
|
618 |
+
}
|
619 |
+
return $comment_delete_count;
|
620 |
+
}
|
621 |
+
|
622 |
+
/**
|
623 |
+
* Do Delete operation on comments.
|
624 |
+
*
|
625 |
+
* @access public
|
626 |
+
* @since 1.1.0
|
627 |
+
* @param array $data $_POST.
|
628 |
+
* @return deleted comments count.
|
629 |
+
*/
|
630 |
+
public function do_delete_comments( $data = array() ) {
|
631 |
+
global $wpdb;
|
632 |
+
|
633 |
+
$comment_delete_count = 0;
|
634 |
+
$delete_comment_status = ( $data['delete_comment_status'] ) ? $data['delete_comment_status'] : array();
|
635 |
+
$delete_comment_status = array_map('esc_sql', $delete_comment_status );
|
636 |
+
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
637 |
+
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
638 |
+
|
639 |
+
if ( ! empty( $data ) ){
|
640 |
+
|
641 |
+
$temp_delete_query = array();
|
642 |
+
|
643 |
+
if( ! empty( $delete_comment_status ) ){
|
644 |
+
foreach ( $delete_comment_status as $comment_status ) {
|
645 |
+
|
646 |
+
switch( $comment_status ) {
|
647 |
+
case 'pending':
|
648 |
+
$temp_delete_query[] = "comment_approved = '0'";
|
649 |
+
break;
|
650 |
+
|
651 |
+
case 'spam':
|
652 |
+
$temp_delete_query[] = "comment_approved = 'spam'";
|
653 |
+
break;
|
654 |
+
|
655 |
+
case 'trash':
|
656 |
+
$temp_delete_query[] = "comment_approved = 'trash' OR comment_approved = 'post-trashed'";
|
657 |
+
break;
|
658 |
+
break;
|
659 |
+
|
660 |
+
case 'approved':
|
661 |
+
$temp_delete_query[] = "comment_approved = '1'";
|
662 |
+
break;
|
663 |
+
}
|
664 |
+
|
665 |
+
}
|
666 |
+
if( !empty( $temp_delete_query ) ) {
|
667 |
+
$delete_comment_query = "DELETE FROM $wpdb->comments WHERE 1=1";
|
668 |
+
$delete_comment_query .= " AND (" . implode( " OR ", $temp_delete_query ) . ")";
|
669 |
+
}
|
670 |
+
}
|
671 |
+
|
672 |
+
if( $delete_start_date != ''){
|
673 |
+
$delete_comment_query .= " AND ( comment_date >= '{$delete_start_date} 00:00:00' )";
|
674 |
+
}
|
675 |
+
if( $delete_end_date != ''){
|
676 |
+
$delete_comment_query .= " AND ( comment_date <= '{$delete_end_date} 23:59:59' )";
|
677 |
+
}
|
678 |
+
$comment_delete_count = $wpdb->query( $delete_comment_query );
|
679 |
+
}
|
680 |
+
return $comment_delete_count;
|
681 |
+
}
|
682 |
+
|
683 |
+
/**
|
684 |
+
* Get postmeta Ids.
|
685 |
+
*
|
686 |
+
* @access public
|
687 |
+
* @since 1.1.0
|
688 |
+
* @param array $data Delete postmeta form data.
|
689 |
+
* @return array | Posts Id.
|
690 |
+
*/
|
691 |
+
public function get_delete_postmeta_ids( $data = array() ) {
|
692 |
+
global $wpdb;
|
693 |
+
if( ! empty( $data['meta_post_type'] ) && ! empty( $data['custom_field_key'] ) ){
|
694 |
+
|
695 |
+
$post_type = ( $data['meta_post_type'] ) ? esc_sql( $data['meta_post_type'] ) : '';
|
696 |
+
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
697 |
+
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
698 |
+
|
699 |
+
// Post Query Generation.
|
700 |
+
$postquery = "SELECT DISTINCT $wpdb->posts.ID FROM $wpdb->posts ";
|
701 |
+
|
702 |
+
$postquery .= " WHERE $wpdb->posts.post_type = '" . $post_type . "'";
|
703 |
+
|
704 |
+
if( $delete_start_date != ''){
|
705 |
+
$postquery .= " AND ( $wpdb->posts.post_date >= '{$delete_start_date} 00:00:00' )";
|
706 |
+
}
|
707 |
+
if( $delete_end_date != ''){
|
708 |
+
$postquery .= " AND ( $wpdb->posts.post_date <= '{$delete_end_date} 23:59:59' )";
|
709 |
+
}
|
710 |
+
|
711 |
+
$metaQuery = $metaWhere = "";
|
712 |
+
$metaWhere = $this->get_meta_where( $data );
|
713 |
+
|
714 |
+
if( $metaWhere != '' ){
|
715 |
+
$metaQuery = "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE post_id IN ( {$postquery} ) AND ( {$metaWhere} )";
|
716 |
+
}else{
|
717 |
+
return array();
|
718 |
+
}
|
719 |
+
|
720 |
+
if( $metaQuery == '' ){
|
721 |
+
return array();
|
722 |
+
}
|
723 |
+
$meta_results = $wpdb->get_results( $metaQuery );
|
724 |
+
return $meta_results;
|
725 |
+
}else{
|
726 |
+
return array();
|
727 |
+
}
|
728 |
+
}
|
729 |
+
|
730 |
+
/**
|
731 |
+
* Do Delete operation on postmetas.
|
732 |
+
*
|
733 |
+
* @access public
|
734 |
+
* @since 1.1.0
|
735 |
+
* @param array $data Postmeta results
|
736 |
+
* @return array | deleted postmetas count.
|
737 |
+
*/
|
738 |
+
public function do_delete_postmetas( $meta_results = array() ) {
|
739 |
+
$postmeta_delete_count = 0;
|
740 |
+
|
741 |
+
if ( ! empty( $meta_results ) ){
|
742 |
+
|
743 |
+
foreach ($meta_results as $meta ) {
|
744 |
+
$post_id = intval( $meta->post_id );
|
745 |
+
if( $post_id === 0 ) {
|
746 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta->meta_key ) );
|
747 |
+
} else {
|
748 |
+
delete_post_meta( $post_id, $meta->meta_key );
|
749 |
+
}
|
750 |
+
}
|
751 |
+
$post_delete_count = number_format_i18n( sizeof( $meta_results ) );
|
752 |
+
|
753 |
+
}
|
754 |
+
return $post_delete_count;
|
755 |
+
}
|
756 |
+
|
757 |
+
/**
|
758 |
+
* Get commentmeta Ids.
|
759 |
+
*
|
760 |
+
* @access public
|
761 |
+
* @since 1.1.0
|
762 |
+
* @param array $data Delete commentmeta form data.
|
763 |
+
* @return array | Meta results.
|
764 |
+
*/
|
765 |
+
public function get_delete_commentmeta_ids( $data = array() ) {
|
766 |
+
global $wpdb;
|
767 |
+
if( $data['custom_field_key'] != '' ){
|
768 |
+
|
769 |
+
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
770 |
+
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
771 |
+
|
772 |
+
// Post Query Generation.
|
773 |
+
$commentquery = "SELECT DISTINCT $wpdb->comments.comment_ID FROM $wpdb->comments WHERE 1 = 1";
|
774 |
+
|
775 |
+
if( $delete_start_date != ''){
|
776 |
+
$commentquery .= " AND ( $wpdb->comments.comment_date >= '{$delete_start_date} 00:00:00' )";
|
777 |
+
}
|
778 |
+
if( $delete_end_date != ''){
|
779 |
+
$commentquery .= " AND ( $wpdb->comments.comment_date <= '{$delete_end_date} 23:59:59' )";
|
780 |
+
}
|
781 |
+
|
782 |
+
$metaQuery = $metaWhere = "";
|
783 |
+
$metaWhere = $this->get_meta_where( $data );
|
784 |
+
|
785 |
+
if( $metaWhere != '' ){
|
786 |
+
$metaQuery = "SELECT comment_id, meta_key FROM $wpdb->commentmeta WHERE comment_id IN ( {$commentquery} ) AND ( {$metaWhere} )";
|
787 |
+
}else{
|
788 |
+
return array();
|
789 |
+
}
|
790 |
+
|
791 |
+
if( $metaQuery == '' ){
|
792 |
+
return array();
|
793 |
+
}
|
794 |
+
$meta_results = $wpdb->get_results( $metaQuery );
|
795 |
+
return $meta_results;
|
796 |
+
}else{
|
797 |
+
return array();
|
798 |
+
}
|
799 |
+
}
|
800 |
+
|
801 |
+
/**
|
802 |
+
* Do Delete operation on commentmetas.
|
803 |
+
*
|
804 |
+
* @access public
|
805 |
+
* @since 1.1.0
|
806 |
+
* @param array $data commentmeta results
|
807 |
+
* @return array | deleted commentmeta count.
|
808 |
+
*/
|
809 |
+
public function do_delete_commentmetas( $meta_results = array() ) {
|
810 |
+
$postmeta_delete_count = 0;
|
811 |
+
|
812 |
+
if ( ! empty( $meta_results ) ){
|
813 |
+
|
814 |
+
foreach ($meta_results as $meta ) {
|
815 |
+
$comment_id = intval( $meta->comment_id );
|
816 |
+
if( $comment_id === 0 ) {
|
817 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->commentmeta WHERE comment_id = %d AND meta_key = %s", $comment_id, $meta->meta_key ) );
|
818 |
+
} else {
|
819 |
+
delete_comment_meta( $comment_id, $meta->meta_key );
|
820 |
+
}
|
821 |
+
}
|
822 |
+
$post_delete_count = number_format_i18n( sizeof( $meta_results ) );
|
823 |
+
|
824 |
+
}
|
825 |
+
return $post_delete_count;
|
826 |
+
}
|
827 |
+
|
828 |
+
/**
|
829 |
+
* Get usermeta Ids.
|
830 |
+
*
|
831 |
+
* @access public
|
832 |
+
* @since 1.1.0
|
833 |
+
* @param array $data Delete usermeta form data.
|
834 |
+
* @return array | Meta results.
|
835 |
+
*/
|
836 |
+
public function get_delete_usermeta_ids( $data = array() ) {
|
837 |
+
global $wpdb;
|
838 |
+
if( $data['custom_field_key'] != '' && !empty( $data['delete_user_roles'] ) ){
|
839 |
+
|
840 |
+
$delete_user_roles = ( $data['delete_user_roles'] ) ? $data['delete_user_roles'] : array();
|
841 |
+
$delete_start_date = ( $data['delete_start_date'] ) ? esc_sql( $data['delete_start_date'] ) : '';
|
842 |
+
$delete_end_date = ( $data['delete_end_date'] ) ? esc_sql( $data['delete_end_date'] ) : '';
|
843 |
+
|
844 |
+
$userquery = "SELECT DISTINCT $wpdb->users.ID FROM $wpdb->users ";
|
845 |
+
|
846 |
+
if( !empty( $delete_user_roles ) ){
|
847 |
+
$i = 1;
|
848 |
+
foreach ($delete_user_roles as $delete_user_role ) {
|
849 |
+
$userquery .= " INNER JOIN $wpdb->usermeta AS mt{$i} ON ( $wpdb->users.ID = mt{$i}.user_id )";
|
850 |
+
$i++;
|
851 |
+
}
|
852 |
+
}
|
853 |
+
$userquery .= " WHERE 1 = 1";
|
854 |
+
if( !empty( $delete_user_roles ) ){
|
855 |
+
$j = 1;
|
856 |
+
$subquery = array();
|
857 |
+
foreach ($delete_user_roles as $delete_user_role ) {
|
858 |
+
$subquery[]= "( mt{$j}.meta_key = '{$wpdb->prefix}capabilities' AND mt{$j}.meta_value LIKE '%\"{$delete_user_role}\"%' )";
|
859 |
+
$j++;
|
860 |
+
}
|
861 |
+
$subquery = implode( ' OR ', $subquery );
|
862 |
+
$userquery .= " AND ( {$subquery} )";
|
863 |
+
}
|
864 |
+
|
865 |
+
// User Query Generation.
|
866 |
+
if( $delete_start_date != '' || $delete_end_date != '' ){
|
867 |
+
|
868 |
+
if( $delete_start_date != '' ){
|
869 |
+
$userquery .= " AND ( $wpdb->users.user_registered >= '{$delete_start_date} 00:00:00' )";
|
870 |
+
}
|
871 |
+
if( $delete_end_date != '' ){
|
872 |
+
$userquery .= " AND ( $wpdb->users.user_registered <= '{$delete_end_date} 23:59:59' )";
|
873 |
+
}
|
874 |
+
}
|
875 |
+
|
876 |
+
$metaQuery = $metaWhere = "";
|
877 |
+
$metaWhere = $this->get_meta_where( $data );
|
878 |
+
|
879 |
+
if( $metaWhere != '' ){
|
880 |
+
$metaQuery = "SELECT user_id, meta_key FROM $wpdb->usermeta WHERE user_id IN ( {$userquery} ) AND ( {$metaWhere} )";
|
881 |
+
|
882 |
+
}else{
|
883 |
+
return array();
|
884 |
+
}
|
885 |
+
|
886 |
+
if( $metaQuery == '' ){
|
887 |
+
return array();
|
888 |
+
}
|
889 |
+
$meta_results = $wpdb->get_results( $metaQuery );
|
890 |
+
return $meta_results;
|
891 |
+
|
892 |
+
}else{
|
893 |
+
return array();
|
894 |
+
}
|
895 |
+
}
|
896 |
+
|
897 |
+
/**
|
898 |
+
* Do Delete operation on usermetas.
|
899 |
+
*
|
900 |
+
* @access public
|
901 |
+
* @since 1.1.0
|
902 |
+
* @param array $data usermeta results
|
903 |
+
* @return array | deleted usermeta count.
|
904 |
+
*/
|
905 |
+
public function do_delete_usermetas( $meta_results = array() ) {
|
906 |
+
$usermeta_delete_count = 0;
|
907 |
+
if ( ! empty( $meta_results ) ){
|
908 |
+
|
909 |
+
foreach ($meta_results as $meta ) {
|
910 |
+
$user_id = intval( $meta->user_id );
|
911 |
+
if( $user_id === 0 ) {
|
912 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta->meta_key ) );
|
913 |
+
} else {
|
914 |
+
delete_user_meta( $user_id, $meta->meta_key );
|
915 |
+
}
|
916 |
+
}
|
917 |
+
$usermeta_delete_count = number_format_i18n( sizeof( $meta_results ) );
|
918 |
+
|
919 |
+
}
|
920 |
+
return $usermeta_delete_count;
|
921 |
+
}
|
922 |
+
|
923 |
+
/**
|
924 |
+
* Get delete Term count.
|
925 |
+
*
|
926 |
+
* @access public
|
927 |
+
* @since 1.1.0
|
928 |
+
* @param array $data Delete terms form data.
|
929 |
+
* @return int | Term count.
|
930 |
+
*/
|
931 |
+
public function get_delete_term_count( $data = array() ){
|
932 |
+
|
933 |
+
if( $data['delete_post_type'] == '' && $data['post_taxonomy'] == '' ){
|
934 |
+
return 0;
|
935 |
+
}
|
936 |
+
|
937 |
+
return $numTerms = wp_count_terms( $data['post_taxonomy'], array( 'hide_empty'=> false ) );
|
938 |
|
939 |
+
}
|
940 |
+
|
941 |
+
/**
|
942 |
+
* Do Delete operation on taxonomy terms.
|
943 |
+
*
|
944 |
+
* @access public
|
945 |
+
* @since 1.1.0
|
946 |
+
* @param array $data Delete terms form data.
|
947 |
+
* @return array | deleted terms count.
|
948 |
+
*/
|
949 |
+
public function do_delete_terms( $data = array() ) {
|
950 |
+
$terms_delete_count = 0;
|
951 |
+
if ( ! empty( $data ) ){
|
952 |
+
|
953 |
+
if( $data['delete_post_type'] == '' || $data['post_taxonomy'] == '' ){
|
954 |
+
return $terms_delete_count;
|
955 |
+
}
|
956 |
+
|
957 |
+
$terms = get_terms( $data['post_taxonomy'], array( 'fields' => 'ids', 'hide_empty' => false ) );
|
958 |
+
foreach ( $terms as $value ) {
|
959 |
+
wp_delete_term( $value, $data['post_taxonomy'] );
|
960 |
+
}
|
961 |
+
$terms_delete_count = number_format_i18n( sizeof( $terms ) );
|
962 |
+
}
|
963 |
+
return $terms_delete_count;
|
964 |
+
}
|
965 |
+
|
966 |
+
/**
|
967 |
+
* Generate WHERE condition for meta delete.
|
968 |
+
*
|
969 |
+
* @access public
|
970 |
+
* @since 1.1.0
|
971 |
+
* @param array $data Delete form data.
|
972 |
+
* @return string | WHERE Condition for query.
|
973 |
+
*/
|
974 |
+
function get_meta_where( $data ){
|
975 |
+
// Costomfields
|
976 |
+
$custom_field_key = ( $data['custom_field_key'] ) ? esc_sql( $data['custom_field_key'] ) : '';
|
977 |
+
$custom_field_value = ( $data['custom_field_value'] ) ? esc_sql( $data['custom_field_value'] ) : '';
|
978 |
+
$custom_field_compare = ( $data['custom_field_compare'] ) ? $data['custom_field_compare'] : 'equal_to_str';
|
979 |
+
$metaWhere = '';
|
980 |
+
|
981 |
+
if ( $custom_field_key != '' ) {
|
982 |
+
$metaWhere .= "( meta_key = '" . $custom_field_key. "'";
|
983 |
+
|
984 |
+
if( $custom_field_compare != '' && $custom_field_value != '' ){
|
985 |
+
switch ( $custom_field_compare ) {
|
986 |
+
case 'equal_to_str':
|
987 |
+
$metaWhere .= " AND meta_value = '{$custom_field_value}' )";
|
988 |
+
break;
|
989 |
+
|
990 |
+
case 'notequal_to_str':
|
991 |
+
$metaWhere .= " AND meta_value != '{$custom_field_value}' )";
|
992 |
+
break;
|
993 |
+
|
994 |
+
case 'like_str':
|
995 |
+
$metaWhere .= " AND meta_value LIKE '%{$custom_field_value}%' )";
|
996 |
+
break;
|
997 |
+
|
998 |
+
case 'notlike_str':
|
999 |
+
$metaWhere .= " AND meta_value NOT LIKE '%{$custom_field_value}%' )";
|
1000 |
+
break;
|
1001 |
+
|
1002 |
+
case 'equal_to_date':
|
1003 |
+
$metaWhere .= " AND CAST(meta_value AS DATE) = '{$custom_field_value}' )";
|
1004 |
+
break;
|
1005 |
+
|
1006 |
+
case 'notequal_to_date':
|
1007 |
+
$metaWhere .= " AND CAST(meta_value AS DATE) != '{$custom_field_value}' )";
|
1008 |
+
break;
|
1009 |
+
|
1010 |
+
case 'lessthen_date':
|
1011 |
+
$metaWhere .= " AND CAST(meta_value AS DATE) < '{$custom_field_value}' )";
|
1012 |
+
break;
|
1013 |
+
|
1014 |
+
case 'lessthenequal_date':
|
1015 |
+
$metaWhere .= " AND CAST(meta_value AS DATE) <= '{$custom_field_value}' )";
|
1016 |
+
break;
|
1017 |
+
|
1018 |
+
case 'greaterthen_date':
|
1019 |
+
$metaWhere .= " AND CAST(meta_value AS DATE) > '{$custom_field_value}' )";
|
1020 |
+
break;
|
1021 |
+
|
1022 |
+
case 'greaterthenequal_date':
|
1023 |
+
$metaWhere .= " AND CAST(meta_value AS DATE) >= '{$custom_field_value}' )";
|
1024 |
+
break;
|
1025 |
+
|
1026 |
+
case 'equal_to_number':
|
1027 |
+
$metaWhere .= " AND CAST(meta_value AS SIGNED) = '{$custom_field_value}' )";
|
1028 |
+
break;
|
1029 |
+
|
1030 |
+
case 'notequal_to_number':
|
1031 |
+
$metaWhere .= " AND CAST(meta_value AS SIGNED) != '{$custom_field_value}' )";
|
1032 |
+
break;
|
1033 |
+
|
1034 |
+
case 'lessthen_number':
|
1035 |
+
$metaWhere .= " AND CAST(meta_value AS SIGNED) < '{$custom_field_value}' )";
|
1036 |
+
break;
|
1037 |
+
|
1038 |
+
case 'lessthenequal_number':
|
1039 |
+
$metaWhere .= " AND CAST(meta_value AS SIGNED) <= '{$custom_field_value}' )";
|
1040 |
+
break;
|
1041 |
+
|
1042 |
+
case 'greaterthen_number':
|
1043 |
+
$metaWhere .= " AND CAST(meta_value AS SIGNED) > '{$custom_field_value}' )";
|
1044 |
+
break;
|
1045 |
+
|
1046 |
+
case 'greaterthenequal_number':
|
1047 |
+
$metaWhere .= " AND CAST(meta_value AS SIGNED) >= '{$custom_field_value}' )";
|
1048 |
+
break;
|
1049 |
+
|
1050 |
+
default:
|
1051 |
+
$metaWhere .= " AND meta_value = '{$custom_field_value}' )";
|
1052 |
+
break;
|
1053 |
+
}
|
1054 |
+
}else{
|
1055 |
+
$metaWhere .=" )";
|
1056 |
+
}
|
1057 |
+
}
|
1058 |
+
return $metaWhere;
|
1059 |
+
}
|
1060 |
+
}
|
includes/common-functions.php
CHANGED
@@ -53,4 +53,73 @@ function wpbd_get_terms_by_taxonomy( $taxonomy = '' ) {
|
|
53 |
}
|
54 |
}
|
55 |
return $terms;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
53 |
}
|
54 |
}
|
55 |
return $terms;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Display Admin Notices
|
60 |
+
*
|
61 |
+
* @since 1.0
|
62 |
+
* @param array $notice_result Status array
|
63 |
+
* @return void
|
64 |
+
*/
|
65 |
+
function wpbd_display_admin_notice( $notice_result = array() ) {
|
66 |
+
|
67 |
+
if ( ! empty( $notice_result ) && $notice_result['status'] == 1 ){
|
68 |
+
if( !empty( $notice_result['messages'] ) ){
|
69 |
+
foreach ( $notice_result['messages'] as $smessages ) {
|
70 |
+
?>
|
71 |
+
<div class="notice notice-success">
|
72 |
+
<p><strong><?php echo $smessages; ?></strong></p>
|
73 |
+
</div>
|
74 |
+
<?php
|
75 |
+
}
|
76 |
+
}
|
77 |
+
} elseif ( ! empty( $notice_result ) && $notice_result['status'] == 0 ){
|
78 |
+
|
79 |
+
if( !empty( $notice_result['messages'] ) ){
|
80 |
+
foreach ( $notice_result['messages'] as $emessages ) {
|
81 |
+
?>
|
82 |
+
<div class="notice notice-error">
|
83 |
+
<p><strong><?php echo $emessages; ?></strong></p>
|
84 |
+
</div>
|
85 |
+
<?php
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Display Admin Notices
|
94 |
+
*
|
95 |
+
* @since 1.0
|
96 |
+
* @param array $notice_result Status array
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
+
function wpbd_display_available_in_pro() {
|
100 |
+
?>
|
101 |
+
<span style="color: red"><?php _e('Available in Pro version.','wp-bulk-delete'); ?></span>
|
102 |
+
<a href="<?php echo esc_url(WPBD_PLUGIN_BUY_NOW_URL); ?>"><?php _e('Buy Now','wp-bulk-delete'); ?></a>
|
103 |
+
<?php
|
104 |
+
}
|
105 |
+
add_action( 'wpbd_display_available_in_pro', 'wpbd_display_available_in_pro' );
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Function only for debuging
|
109 |
+
*
|
110 |
+
* @since 1.1
|
111 |
+
*/
|
112 |
+
function wp_p( $data, $exit = false ){
|
113 |
+
|
114 |
+
echo '<pre>';
|
115 |
+
if ( is_array( $data ) || is_object( $data ) ){
|
116 |
+
print_r( $data );
|
117 |
+
} else {
|
118 |
+
echo $data;
|
119 |
+
}
|
120 |
+
echo '</pre>';
|
121 |
+
if ( $exit ) {
|
122 |
+
exit();
|
123 |
+
}
|
124 |
+
|
125 |
}
|
includes/delele-comments-form-functions.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Comments Form Funcitons
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Delete Comments Form Funcitons
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
/** Actions *************************************************************/
|
15 |
+
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_status' );
|
16 |
+
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_users' );
|
17 |
+
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_posts' );
|
18 |
+
add_action( 'wpbd_delete_comments_form', 'wpdb_render_delete_comments_date_interval' );
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Process Delete Comments form
|
22 |
+
*
|
23 |
+
*
|
24 |
+
* @since 1.1.0
|
25 |
+
* @param array $data Form post Data.
|
26 |
+
* @return array | posts ID to be delete.
|
27 |
+
*/
|
28 |
+
function xt_delete_comments_form_process( $data ) {
|
29 |
+
$error = array();
|
30 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
31 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
32 |
+
}
|
33 |
+
if( empty( $data['delete_comment_status'] ) ){
|
34 |
+
$error[] = esc_html__('Please select Comment status for proceed delete operation.', 'wp-bulk-delete' );
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( isset( $data['_delete_comments_wpnonce'] ) && wp_verify_nonce( $data['_delete_comments_wpnonce'], 'delete_comments_nonce' ) ) {
|
38 |
+
|
39 |
+
if( empty( $error ) ){
|
40 |
+
|
41 |
+
$comment_count = wpbulkdelete()->api->do_delete_comments( $data );
|
42 |
+
if( false === $comment_count ){
|
43 |
+
return array(
|
44 |
+
'status' => 0,
|
45 |
+
'messages' => array( esc_html__( 'Something went wrong pelase try again!!', 'wp-bulk-delete' ) ),
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( ! empty( $comment_count ) && $comment_count > 0 ) {
|
50 |
+
return array(
|
51 |
+
'status' => 1,
|
52 |
+
'messages' => array( sprintf( esc_html__( '%d comment(s) deleted successfully.', 'wp-bulk-delete' ), $comment_count )
|
53 |
+
) );
|
54 |
+
} else {
|
55 |
+
return array(
|
56 |
+
'status' => 1,
|
57 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
} else {
|
62 |
+
return array(
|
63 |
+
'status' => 0,
|
64 |
+
'messages' => $error,
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
} else {
|
69 |
+
wp_die( esc_html__( 'Sorry, Your nonce did not verify.', 'wp-bulk-delete' ) );
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Render Userroles checkboxes.
|
75 |
+
*
|
76 |
+
* @since 1.1.0
|
77 |
+
* @return void
|
78 |
+
*/
|
79 |
+
function wpdb_render_delete_comments_status(){
|
80 |
+
$comment_status = array(
|
81 |
+
'pending' => __( 'Pending Comments', 'wp-bulk-delete'),
|
82 |
+
'spam' => __( 'Spam Comments', 'wp-bulk-delete'),
|
83 |
+
'trash' => __( 'Trash Comments', 'wp-bulk-delete'),
|
84 |
+
'approved' => __( 'Approved Comments', 'wp-bulk-delete'),
|
85 |
+
);
|
86 |
+
|
87 |
+
?>
|
88 |
+
<tr>
|
89 |
+
<th scope="row">
|
90 |
+
<?php _e( 'Comment Status', 'wp-bulk-delete' ); ?> :
|
91 |
+
</th>
|
92 |
+
|
93 |
+
<td>
|
94 |
+
<?php
|
95 |
+
if( ! empty( $comment_status ) ){
|
96 |
+
foreach ($comment_status as $comment_status_value => $comment_status_name ) {
|
97 |
+
?>
|
98 |
+
<input name="delete_comment_status[]" class="delete_comment_status" id="comment_status_<?php echo $comment_status_value; ?>" type="checkbox" value="<?php echo $comment_status_value; ?>" >
|
99 |
+
<label for="comment_status_<?php echo $comment_status_value; ?>">
|
100 |
+
<?php echo $comment_status_name . ' ' . sprintf( __( '( %s Comment(s) )', 'wp-bulk-delete' ), wpbulkdelete()->api->get_comment_count( $comment_status_value ) ); ?>
|
101 |
+
</label>
|
102 |
+
<br/>
|
103 |
+
<?php
|
104 |
+
}
|
105 |
+
}
|
106 |
+
?>
|
107 |
+
<p class="description">
|
108 |
+
<?php _e('Select the comment statuses which you want to delete.','wp-bulk-delete'); ?>
|
109 |
+
</p>
|
110 |
+
</td>
|
111 |
+
</tr>
|
112 |
+
<?php
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Render User registration date interval.
|
118 |
+
*
|
119 |
+
* @since 1.0
|
120 |
+
* @return void
|
121 |
+
*/
|
122 |
+
function wpdb_render_delete_comments_date_interval(){
|
123 |
+
?>
|
124 |
+
<tr>
|
125 |
+
<th scope="row">
|
126 |
+
<?php _e('Comment Date :','wp-bulk-delete'); ?>
|
127 |
+
</th>
|
128 |
+
<td>
|
129 |
+
<input type="text" id="delete_start_date" name="delete_start_date" class="delete_all_datepicker" placeholder="Start date" />
|
130 |
+
-
|
131 |
+
<input type="text" id="delete_end_date" name="delete_end_date" class="delete_all_datepicker" placeholder="End date" />
|
132 |
+
<p class="description">
|
133 |
+
<?php _e('Set the date interval for comments to delete ( only delete comments between these dates ) or leave these fields blank to select all comments. The dates must be specified in the following format: <strong>YYYY-MM-DD</strong>','wp-bulk-delete'); ?>
|
134 |
+
</p>
|
135 |
+
</td>
|
136 |
+
</tr>
|
137 |
+
<?php
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Render Users Dropdown for comment authors.
|
142 |
+
*
|
143 |
+
* @since 1.1
|
144 |
+
* @return void
|
145 |
+
*/
|
146 |
+
function wpdb_render_delete_comments_users(){
|
147 |
+
?>
|
148 |
+
<tr>
|
149 |
+
<th scope="row">
|
150 |
+
<?php _e('Comment Author','wp-bulk-delete'); ?> :
|
151 |
+
</th>
|
152 |
+
<td>
|
153 |
+
<select name="sample1" class="sample1" disabled="disabled" >
|
154 |
+
<option value=""><?php esc_attr_e( 'Select author', 'wp-bulk-delete' ); ?></option>
|
155 |
+
</select>
|
156 |
+
<p class="description">
|
157 |
+
<?php _e('Select comment author whose comment you want to delete.','wp-bulk-delete'); ?>
|
158 |
+
</p>
|
159 |
+
<?php do_action( 'wpbd_display_available_in_pro'); ?>
|
160 |
+
</td>
|
161 |
+
</tr>
|
162 |
+
<?php
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Render Posts Dropdown for comment posts.
|
167 |
+
*
|
168 |
+
* @since 1.1
|
169 |
+
* @return void
|
170 |
+
*/
|
171 |
+
function wpdb_render_delete_comments_posts(){
|
172 |
+
?>
|
173 |
+
<tr>
|
174 |
+
<th scope="row">
|
175 |
+
<?php _e('Comment Post','wp-bulk-delete'); ?> :
|
176 |
+
</th>
|
177 |
+
<td>
|
178 |
+
<select name="sample2" class="sample2" disabled="disabled" >
|
179 |
+
<option value=""><?php esc_attr_e( 'Select post', 'wp-bulk-delete' ); ?></option>
|
180 |
+
</select>
|
181 |
+
<p class="description">
|
182 |
+
<?php _e('Select comment post whose comment you want to delete.','wp-bulk-delete'); ?>
|
183 |
+
</p>
|
184 |
+
<?php do_action( 'wpbd_display_available_in_pro'); ?>
|
185 |
+
</td>
|
186 |
+
</tr>
|
187 |
+
<?php
|
188 |
+
}
|
includes/delele-meta-form-functions.php
ADDED
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Form Process
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Form Process
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
/** Actions *************************************************************/
|
15 |
+
// postmeta
|
16 |
+
add_action( 'render_postmeta_form', 'wpdb_render_meta_form_posttype', 10 );
|
17 |
+
add_action( 'render_postmeta_form', 'wpdb_render_meta_form_postdropdown', 10 );
|
18 |
+
add_action( 'render_postmeta_form', 'wpbd_render_meta_fields', 10 );
|
19 |
+
add_action( 'render_postmeta_form', 'wpbd_render_meta_date_interval', 10 );
|
20 |
+
|
21 |
+
// commentmeta
|
22 |
+
add_action( 'render_commentmeta_form', 'wpbd_render_meta_fields', 10 );
|
23 |
+
add_action( 'render_commentmeta_form', 'wpbd_render_meta_date_interval', 10 );
|
24 |
+
|
25 |
+
// usermeta
|
26 |
+
add_action( 'render_usermeta_form', 'wpbd_render_meta_userroles', 10 );
|
27 |
+
add_action( 'render_usermeta_form', 'wpbd_render_meta_fields', 10 );
|
28 |
+
add_action( 'render_usermeta_form', 'wpbd_render_meta_date_interval', 10 );
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Process Delete meta form
|
32 |
+
*
|
33 |
+
*
|
34 |
+
* @since 1.0
|
35 |
+
* @param array $data meta form data.
|
36 |
+
* @return array | with status and message.
|
37 |
+
*/
|
38 |
+
function wpbd_delete_meta_form_process( $data ) {
|
39 |
+
$error = $meta_results = array();
|
40 |
+
$meta_count = 0;
|
41 |
+
|
42 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
43 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
44 |
+
}
|
45 |
+
|
46 |
+
if ( isset( $data['_delete_meta_wpnonce'] ) && wp_verify_nonce( $data['_delete_meta_wpnonce'], 'delete_meta_nonce' ) ) {
|
47 |
+
|
48 |
+
if( empty( $error ) ){
|
49 |
+
|
50 |
+
// Get meta_results for delete based on user input.
|
51 |
+
if( 'postmeta' == $data['meta_type'] ) {
|
52 |
+
$meta_results = wpbulkdelete()->api->get_delete_postmeta_ids( $data );
|
53 |
+
|
54 |
+
} elseif('usermeta' == $data['meta_type'] ) {
|
55 |
+
$meta_results = wpbulkdelete()->api->get_delete_usermeta_ids( $data );
|
56 |
+
|
57 |
+
} elseif('commentmeta' == $data['meta_type'] ) {
|
58 |
+
$meta_results = wpbulkdelete()->api->get_delete_commentmeta_ids( $data );
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( ! empty( $meta_results ) && count( $meta_results ) > 0 ) {
|
62 |
+
|
63 |
+
if( 'postmeta' == $data['meta_type'] ) {
|
64 |
+
$meta_count = wpbulkdelete()->api->do_delete_postmetas( $meta_results );
|
65 |
+
|
66 |
+
} elseif('usermeta' == $data['meta_type'] ) {
|
67 |
+
$meta_count = wpbulkdelete()->api->do_delete_usermetas( $meta_results );
|
68 |
+
|
69 |
+
} elseif('commentmeta' == $data['meta_type'] ) {
|
70 |
+
$meta_count = wpbulkdelete()->api->do_delete_commentmetas( $meta_results );
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
return array(
|
75 |
+
'status' => 1,
|
76 |
+
'messages' => array( sprintf( esc_html__( '%d Meta deleted successfully.', 'wp-bulk-delete' ), $meta_count)
|
77 |
+
) );
|
78 |
+
} else {
|
79 |
+
return array(
|
80 |
+
'status' => 1,
|
81 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
} else {
|
86 |
+
return array(
|
87 |
+
'status' => 0,
|
88 |
+
'messages' => $error,
|
89 |
+
);
|
90 |
+
}
|
91 |
+
|
92 |
+
} else {
|
93 |
+
wp_die( esc_html__( 'Sorry, Your nonce did not verify.', 'wp-bulk-delete' ) );
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Render meta cleanup options
|
99 |
+
*
|
100 |
+
* @since 1.1.0
|
101 |
+
* @return void
|
102 |
+
*/
|
103 |
+
function wpbd_render_meta_cleanup(){
|
104 |
+
// Counts
|
105 |
+
$orphan_postmeta_count = wpbulkdelete()->api->get_post_count('orphan_postmeta');
|
106 |
+
$duplicated_postmeta_count = wpbulkdelete()->api->get_post_count('duplicated_postmeta');
|
107 |
+
$orphan_commentmeta_count = wpbulkdelete()->api->get_post_count('orphan_commentmeta');
|
108 |
+
$duplicated_commentmeta_count = wpbulkdelete()->api->get_post_count('duplicated_commentmeta');
|
109 |
+
$orphan_usermeta_count = wpbulkdelete()->api->get_post_count('orphan_usermeta');
|
110 |
+
$duplicated_usermeta_count = wpbulkdelete()->api->get_post_count('duplicated_usermeta');
|
111 |
+
$orphan_termmeta_count = wpbulkdelete()->api->get_post_count('orphan_termmeta');
|
112 |
+
$duplicated_termmeta_count = wpbulkdelete()->api->get_post_count('duplicated_termmeta');
|
113 |
+
?>
|
114 |
+
<tr>
|
115 |
+
<th scope="row">
|
116 |
+
<?php _e('Cleanup Meta :','wp-bulk-delete'); ?>
|
117 |
+
</th>
|
118 |
+
<td>
|
119 |
+
<fieldset>
|
120 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_orphan_postmeta" type="checkbox" value="orphan_postmeta" checked="checked">
|
121 |
+
<label for="cleanup_orphan_postmeta">
|
122 |
+
<?php printf( __( 'Orphaned Post Meta (%d Post Meta)', 'wp-bulk-delete' ), $orphan_postmeta_count ); ?>
|
123 |
+
</label>
|
124 |
+
</fieldset>
|
125 |
+
|
126 |
+
<fieldset>
|
127 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_duplicated_postmeta" type="checkbox" value="duplicated_postmeta" checked="checked">
|
128 |
+
<label for="cleanup_duplicated_postmeta">
|
129 |
+
<?php printf( __( 'Duplicated Post Meta (%d Post Meta)', 'wp-bulk-delete' ), $duplicated_postmeta_count ); ?>
|
130 |
+
</label>
|
131 |
+
</fieldset>
|
132 |
+
|
133 |
+
<fieldset>
|
134 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_orphan_commentmeta" type="checkbox" value="orphan_commentmeta" checked="checked">
|
135 |
+
<label for="cleanup_orphan_commentmeta">
|
136 |
+
<?php printf( __( 'Orphaned Comment Meta (%d Comment Meta)', 'wp-bulk-delete' ), $orphan_commentmeta_count ); ?>
|
137 |
+
</label>
|
138 |
+
</fieldset>
|
139 |
+
|
140 |
+
<fieldset>
|
141 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_duplicated_commentmeta" type="checkbox" value="duplicated_commentmeta" checked="checked">
|
142 |
+
<label for="cleanup_duplicated_commentmeta">
|
143 |
+
<?php printf( __( 'Duplicated Comment Meta (%d Comment Meta)', 'wp-bulk-delete' ), $duplicated_commentmeta_count ); ?>
|
144 |
+
</label>
|
145 |
+
</fieldset>
|
146 |
+
|
147 |
+
<fieldset>
|
148 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_orphan_usermeta" type="checkbox" value="orphan_usermeta" checked="checked">
|
149 |
+
<label for="cleanup_orphan_usermeta">
|
150 |
+
<?php printf( __( 'Orphaned User Meta (%d User Meta)', 'wp-bulk-delete' ), $orphan_usermeta_count ); ?>
|
151 |
+
</label>
|
152 |
+
</fieldset>
|
153 |
+
|
154 |
+
<fieldset>
|
155 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_duplicated_usermeta" type="checkbox" value="duplicated_usermeta" checked="checked">
|
156 |
+
<label for="cleanup_duplicated_usermeta">
|
157 |
+
<?php printf( __( 'Duplicated User Meta (%d User Meta)', 'wp-bulk-delete' ), $duplicated_usermeta_count ); ?>
|
158 |
+
</label>
|
159 |
+
</fieldset>
|
160 |
+
|
161 |
+
<fieldset>
|
162 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_orphan_termmeta" type="checkbox" value="orphan_termmeta" checked="checked">
|
163 |
+
<label for="cleanup_orphan_termmeta">
|
164 |
+
<?php printf( __( 'Orphaned Term Meta (%d Term Meta)', 'wp-bulk-delete' ), $orphan_commentmeta_count ); ?>
|
165 |
+
</label>
|
166 |
+
</fieldset>
|
167 |
+
|
168 |
+
<fieldset>
|
169 |
+
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_duplicated_termmeta" type="checkbox" value="duplicated_termmeta" checked="checked">
|
170 |
+
<label for="cleanup_duplicated_termmeta">
|
171 |
+
<?php printf( __( 'Duplicated Term Meta (%d Term Meta)', 'wp-bulk-delete' ), $duplicated_termmeta_count ); ?>
|
172 |
+
</label>
|
173 |
+
</fieldset>
|
174 |
+
|
175 |
+
</td>
|
176 |
+
</tr>
|
177 |
+
<?php
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Render post meta post options
|
182 |
+
*
|
183 |
+
* @since 1.1.0
|
184 |
+
* @return void
|
185 |
+
*/
|
186 |
+
function wpdb_render_meta_form_posttype(){
|
187 |
+
global $wp_post_types;
|
188 |
+
$ingnore_types = array('attachment','revision','nav_menu_item');
|
189 |
+
$types = array();
|
190 |
+
if( !empty( $wp_post_types ) ){
|
191 |
+
foreach( $wp_post_types as $key_type => $post_type ){
|
192 |
+
if( in_array( $key_type, $ingnore_types ) ){
|
193 |
+
continue;
|
194 |
+
}else{
|
195 |
+
$types[$key_type] = $post_type->labels->name;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
?>
|
200 |
+
<tr>
|
201 |
+
<th scope="row">
|
202 |
+
<?php _e('Post type:','wp-bulk-delete'); ?>
|
203 |
+
</th>
|
204 |
+
<td>
|
205 |
+
<select name="meta_post_type" class="meta_post_type" id="meta_post_type" required="required">
|
206 |
+
<?php
|
207 |
+
if( !empty( $types ) ){
|
208 |
+
foreach( $types as $key_type => $type ){
|
209 |
+
?>
|
210 |
+
<fieldset>
|
211 |
+
<label for="meta_post_type">
|
212 |
+
<option value="<?php echo $key_type; ?>">
|
213 |
+
<?php printf( __( '%s', 'wp-bulk-delete' ), $type ); ?>
|
214 |
+
</option>
|
215 |
+
</label>
|
216 |
+
</fieldset>
|
217 |
+
<?php
|
218 |
+
}
|
219 |
+
}else{
|
220 |
+
_e('No post types are there, WP Bulk Delete will not work.','wp-bulk-delete');
|
221 |
+
}
|
222 |
+
?>
|
223 |
+
</select>
|
224 |
+
<p class="description">
|
225 |
+
<?php esc_html_e('Select the post type whose post meta fields you want to delete.','wp-bulk-delete'); ?>
|
226 |
+
</p>
|
227 |
+
</td>
|
228 |
+
</tr>
|
229 |
+
<?php
|
230 |
+
}
|
231 |
+
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Render meta Fields.
|
235 |
+
*
|
236 |
+
* @since 1.1.0
|
237 |
+
* @return void
|
238 |
+
*/
|
239 |
+
function wpbd_render_meta_fields(){
|
240 |
+
?>
|
241 |
+
<tr>
|
242 |
+
<th scope="row">
|
243 |
+
<?php _e('Meta fields','wp-bulk-delete'); ?> :
|
244 |
+
</th>
|
245 |
+
<td>
|
246 |
+
<?php esc_html_e( 'Meta key', 'wp-bulk-delete' ); ?>
|
247 |
+
<input type="text" id="custom_field_key" name="custom_field_key" class="custom_field_key" placeholder="<?php esc_html_e( 'Meta key (Required)', 'wp-bulk-delete' ); ?>" required="required" />
|
248 |
+
<select name="custom_field_compare">
|
249 |
+
<option value="equal_to_str"><?php esc_html_e( 'equal to ( string )', 'wp-bulk-delete' ); ?></option>
|
250 |
+
<option value="notequal_to_str"><?php esc_html_e( 'not equal to ( string )', 'wp-bulk-delete' ); ?></option>
|
251 |
+
<option value="like_str"><?php esc_html_e( 'like ( string )', 'wp-bulk-delete' ); ?></option>
|
252 |
+
<option value="notlike_str"><?php esc_html_e( 'not like ( string )', 'wp-bulk-delete' ); ?></option><option value="equal_to_date"><?php esc_html_e( 'equal to ( date )', 'wp-bulk-delete' ); ?></option>
|
253 |
+
<option value="notequal_to_date"><?php esc_html_e( 'not equal to ( date )', 'wp-bulk-delete' ); ?></option>
|
254 |
+
<option value="lessthen_date"><?php esc_html_e( 'less then ( date )', 'wp-bulk-delete' ); ?></option>
|
255 |
+
<option value="lessthenequal_date"><?php esc_html_e( 'less then and equal to ( date )', 'wp-bulk-delete' ); ?></option>
|
256 |
+
<option value="greaterthen_date"><?php esc_html_e( 'greater then ( date )', 'wp-bulk-delete' ); ?></option>
|
257 |
+
<option value="greaterthenequal_date"><?php esc_html_e( 'greater then and equal to ( date )', 'wp-bulk-delete' ); ?></option>
|
258 |
+
<option value="equal_to_number"><?php esc_html_e( 'equal to ( number )', 'wp-bulk-delete' ); ?></option>
|
259 |
+
<option value="notequal_to_number"><?php esc_html_e( 'not equal to ( number )', 'wp-bulk-delete' ); ?></option>
|
260 |
+
<option value="lessthen_number"><?php esc_html_e( 'less then ( number )', 'wp-bulk-delete' ); ?></option>
|
261 |
+
<option value="lessthenequal_number"><?php esc_html_e( 'less then and equal to ( number )', 'wp-bulk-delete' ); ?></option>
|
262 |
+
<option value="greaterthen_number"><?php esc_html_e( 'greater then ( number )', 'wp-bulk-delete' ); ?></option>
|
263 |
+
<option value="greaterthenequal_number"><?php esc_html_e( 'greater then and equal to ( number )', 'wp-bulk-delete' ); ?></option>
|
264 |
+
</select>
|
265 |
+
<?php esc_html_e( 'Value', 'wp-bulk-delete' ); ?>
|
266 |
+
<input type="text" id="custom_field_value" name="custom_field_value" class="custom_field_value" placeholder="<?php esc_html_e( 'Meta value (Optional)', 'wp-bulk-delete' ); ?>" />
|
267 |
+
<p class="description">
|
268 |
+
<?php esc_html_e('Enter the meta key for delete meta, please consider following points in to meta delete.','wp-bulk-delete'); ?><br>
|
269 |
+
<?php esc_html_e('1. If you want to delete meta by meta key only enter meta key.','wp-bulk-delete'); ?><br>
|
270 |
+
<?php esc_html_e('2. If you want to delete meta by meta key and meta value then enter both values.','wp-bulk-delete'); ?><br>
|
271 |
+
</p>
|
272 |
+
</td>
|
273 |
+
</tr>
|
274 |
+
<?php
|
275 |
+
}
|
276 |
+
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Render Postmeta Date intervals.
|
280 |
+
*
|
281 |
+
* @since 1.0
|
282 |
+
* @return void
|
283 |
+
*/
|
284 |
+
function wpbd_render_meta_date_interval(){
|
285 |
+
?>
|
286 |
+
<tr>
|
287 |
+
<th scope="row">
|
288 |
+
<?php _e('Date interval :','wp-bulk-delete'); ?>
|
289 |
+
</th>
|
290 |
+
<td>
|
291 |
+
<input type="text" id="delete_start_date" name="delete_start_date" class="delete_all_datepicker" placeholder="<?php esc_html_e('Start Date','wp-bulk-delete');?>" />
|
292 |
+
-
|
293 |
+
<input type="text" id="delete_end_date" name="delete_end_date" class="delete_all_datepicker" placeholder="<?php esc_html_e('End Date','wp-bulk-delete');?>"/>
|
294 |
+
<p class="description">
|
295 |
+
<?php _e('Set the date interval for posts/comments/users whose meta fields will be delete, or leave these fields blank to select all meta. The dates must be specified in the following format: <strong>YYYY-MM-DD</strong>','wp-bulk-delete'); ?>
|
296 |
+
</p>
|
297 |
+
</td>
|
298 |
+
</tr>
|
299 |
+
<?php
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Render Userroles dropdown.
|
304 |
+
*
|
305 |
+
* @since 1.0
|
306 |
+
* @return void
|
307 |
+
*/
|
308 |
+
function wpbd_render_meta_userroles(){
|
309 |
+
$userroles = count_users();
|
310 |
+
?>
|
311 |
+
<tr>
|
312 |
+
<th scope="row">
|
313 |
+
<?php _e( 'User roles', 'wp-bulk-delete' ); ?> :
|
314 |
+
</th>
|
315 |
+
<td>
|
316 |
+
<?php
|
317 |
+
if( ! empty( $userroles['avail_roles'] ) ){
|
318 |
+
foreach ($userroles['avail_roles'] as $userrole => $count ) {
|
319 |
+
?>
|
320 |
+
<input name="delete_user_roles[]" class="delete_user_roles" id="user_role_<?php echo $userrole; ?>" type="checkbox" value="<?php echo $userrole; ?>" >
|
321 |
+
<label for="user_role_<?php echo $userrole; ?>">
|
322 |
+
<?php echo $userrole . ' ' . sprintf( __( '( %s Users )', 'wp-bulk-delete' ), $count ); ?>
|
323 |
+
</label><br/>
|
324 |
+
<?php
|
325 |
+
}
|
326 |
+
}
|
327 |
+
?>
|
328 |
+
<p class="description">
|
329 |
+
<?php _e('Select the user roles from which you want to delete user meta.','wp-bulk-delete'); ?>
|
330 |
+
</p>
|
331 |
+
</td>
|
332 |
+
</tr>
|
333 |
+
<?php
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* Render post dropdown based on posttype selection.
|
338 |
+
*
|
339 |
+
* @since 1.1
|
340 |
+
* @return void
|
341 |
+
*/
|
342 |
+
function wpdb_render_meta_form_postdropdown(){
|
343 |
+
?>
|
344 |
+
<tr>
|
345 |
+
<th scope="row">
|
346 |
+
<?php _e('Post :','wp-bulk-delete'); ?>
|
347 |
+
</th>
|
348 |
+
<td>
|
349 |
+
<div class="postdropdown_space">
|
350 |
+
<select name="sample_post_dropdown" disabled="disabled">
|
351 |
+
<option value=""> <?php esc_html_e( 'Select post', 'wp-bulk-delete' ); ?></option>
|
352 |
+
</select>
|
353 |
+
</div>
|
354 |
+
<p class="description">
|
355 |
+
<?php esc_html_e('Select the post whose post meta fields you want to delete.','wp-bulk-delete'); ?>
|
356 |
+
</p>
|
357 |
+
<?php do_action( 'wpbd_display_available_in_pro'); ?>
|
358 |
+
</td>
|
359 |
+
</tr>
|
360 |
+
<script>
|
361 |
+
jQuery(document).ready(function(){
|
362 |
+
jQuery('#meta_post_type').trigger( 'change' );
|
363 |
+
});
|
364 |
+
</script>
|
365 |
+
<?php
|
366 |
+
}
|
includes/delele-posts-form-functions.php
CHANGED
@@ -285,9 +285,9 @@ function wpbd_render_form_date_interval(){
|
|
285 |
<?php _e('Date interval :','wp-bulk-delete'); ?>
|
286 |
</th>
|
287 |
<td>
|
288 |
-
<input type="
|
289 |
-
|
290 |
-
<input type="
|
291 |
<p class="description">
|
292 |
<?php _e('Set the date interval for items to delete, or leave these fields blank to select all posts. The dates must be specified in the following format: <strong>YYYY-MM-DD</strong>','wp-bulk-delete'); ?>
|
293 |
</p>
|
@@ -316,7 +316,7 @@ function wpbd_render_form_post_contains(){
|
|
316 |
<option value=""><?php _e( "Don't delete It.", "wp-bulk-delete" ); ?> </option>
|
317 |
</select>
|
318 |
<br/>
|
319 |
-
|
320 |
</td>
|
321 |
</tr>
|
322 |
<tr>
|
@@ -331,7 +331,7 @@ function wpbd_render_form_post_contains(){
|
|
331 |
<option value=""><?php _e( "Don't delete It.", "wp-bulk-delete" ); ?> </option>
|
332 |
</select>
|
333 |
<br/>
|
334 |
-
|
335 |
</td>
|
336 |
</tr>
|
337 |
<?php
|
@@ -411,7 +411,7 @@ function wpbd_render_limit_post(){
|
|
411 |
<?php _e('Limit :','wp-bulk-delete'); ?>
|
412 |
</th>
|
413 |
<td>
|
414 |
-
<input type="number" id="limit_post" name="limit_post" class="limit_post_input" />
|
415 |
<p class="description">
|
416 |
<?php _e('Set the limit over post delete. It will delete only first limit posts. This option will help you in case of you have lots of posts to delete and script timeout.','wp-bulk-delete'); ?>
|
417 |
</p>
|
@@ -441,7 +441,7 @@ function wpbd_render_form_custom_fields(){
|
|
441 |
<?php esc_html_e( 'Value', 'wp-bulk-delete' ); ?>
|
442 |
<input type="text" id="disabled_sample3" name="disabled_sample3" class="disabled_sample3" disabled="disabled" />
|
443 |
<br />
|
444 |
-
<span style="color: red">Available in Pro version. </span><a href="<?php echo esc_url(
|
445 |
</td>
|
446 |
</tr>
|
447 |
<?php
|
@@ -457,27 +457,27 @@ function wpbd_render_post_cleanup(){
|
|
457 |
?>
|
458 |
<tr>
|
459 |
<th scope="row">
|
460 |
-
<?php _e('Cleanup
|
461 |
</th>
|
462 |
<td>
|
463 |
<fieldset>
|
464 |
<label for="cleanup_post_type">
|
465 |
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_revision" type="checkbox" value="revision" checked="checked">
|
466 |
-
<?php printf( __( '
|
467 |
</label>
|
468 |
</fieldset>
|
469 |
|
470 |
<fieldset>
|
471 |
<label for="cleanup_post_type">
|
472 |
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_trash" type="checkbox" value="trash" checked="checked">
|
473 |
-
<?php printf( __( '
|
474 |
</label>
|
475 |
</fieldset>
|
476 |
|
477 |
<fieldset>
|
478 |
<label for="cleanup_post_type">
|
479 |
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_revision" type="checkbox" value="auto_drafts" checked="checked">
|
480 |
-
<?php printf( __( '
|
481 |
</label>
|
482 |
</fieldset>
|
483 |
</td>
|
285 |
<?php _e('Date interval :','wp-bulk-delete'); ?>
|
286 |
</th>
|
287 |
<td>
|
288 |
+
<input type="text" id="delete_start_date" name="delete_start_date" class="delete_all_datepicker" />
|
289 |
-
|
290 |
+
<input type="text" id="delete_end_date" name="delete_end_date" class="delete_all_datepicker" />
|
291 |
<p class="description">
|
292 |
<?php _e('Set the date interval for items to delete, or leave these fields blank to select all posts. The dates must be specified in the following format: <strong>YYYY-MM-DD</strong>','wp-bulk-delete'); ?>
|
293 |
</p>
|
316 |
<option value=""><?php _e( "Don't delete It.", "wp-bulk-delete" ); ?> </option>
|
317 |
</select>
|
318 |
<br/>
|
319 |
+
<?php do_action( 'wpbd_display_available_in_pro'); ?>
|
320 |
</td>
|
321 |
</tr>
|
322 |
<tr>
|
331 |
<option value=""><?php _e( "Don't delete It.", "wp-bulk-delete" ); ?> </option>
|
332 |
</select>
|
333 |
<br/>
|
334 |
+
<?php do_action( 'wpbd_display_available_in_pro'); ?>
|
335 |
</td>
|
336 |
</tr>
|
337 |
<?php
|
411 |
<?php _e('Limit :','wp-bulk-delete'); ?>
|
412 |
</th>
|
413 |
<td>
|
414 |
+
<input type="number" min="1" id="limit_post" name="limit_post" class="limit_post_input" />
|
415 |
<p class="description">
|
416 |
<?php _e('Set the limit over post delete. It will delete only first limit posts. This option will help you in case of you have lots of posts to delete and script timeout.','wp-bulk-delete'); ?>
|
417 |
</p>
|
441 |
<?php esc_html_e( 'Value', 'wp-bulk-delete' ); ?>
|
442 |
<input type="text" id="disabled_sample3" name="disabled_sample3" class="disabled_sample3" disabled="disabled" />
|
443 |
<br />
|
444 |
+
<span style="color: red">Available in Pro version. </span><a href="<?php echo esc_url(WPBD_PLUGIN_BUY_NOW_URL); ?>">Buy Now</a>
|
445 |
</td>
|
446 |
</tr>
|
447 |
<?php
|
457 |
?>
|
458 |
<tr>
|
459 |
<th scope="row">
|
460 |
+
<?php _e('Cleanup Posts :','wp-bulk-delete'); ?>
|
461 |
</th>
|
462 |
<td>
|
463 |
<fieldset>
|
464 |
<label for="cleanup_post_type">
|
465 |
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_revision" type="checkbox" value="revision" checked="checked">
|
466 |
+
<?php printf( __( 'Revisions (%d Revisions)', 'wp-bulk-delete' ), wpbulkdelete()->api->get_post_count('revision') ); ?>
|
467 |
</label>
|
468 |
</fieldset>
|
469 |
|
470 |
<fieldset>
|
471 |
<label for="cleanup_post_type">
|
472 |
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_trash" type="checkbox" value="trash" checked="checked">
|
473 |
+
<?php printf( __( 'Trash (Deleted Posts) (%d Trash)', 'wp-bulk-delete' ), wpbulkdelete()->api->get_post_count('trash') ); ?>
|
474 |
</label>
|
475 |
</fieldset>
|
476 |
|
477 |
<fieldset>
|
478 |
<label for="cleanup_post_type">
|
479 |
<input name="cleanup_post_type[]" class="cleanup_post_type" id="cleanup_revision" type="checkbox" value="auto_drafts" checked="checked">
|
480 |
+
<?php printf( __( 'Auto Drafts (%d Auto Drafts)', 'wp-bulk-delete' ), wpbulkdelete()->api->get_post_count('auto_drafts') ); ?>
|
481 |
</label>
|
482 |
</fieldset>
|
483 |
</td>
|
includes/delele-terms-form-functions.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Terms Form Funcitons
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Delete Terms Form Funcitons
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
/** Actions *************************************************************/
|
15 |
+
add_action( 'wpbd_delete_terms_form', 'wpbd_render_form_posttype_dropdown' );
|
16 |
+
add_action( 'wpbd_delete_terms_form', 'wpbd_render_delete_terms_taxonomy' );
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Process Delete Terms form
|
20 |
+
*
|
21 |
+
*
|
22 |
+
* @since 1.1.0
|
23 |
+
* @param array $data Form post Data.
|
24 |
+
* @return array | posts ID to be delete.
|
25 |
+
*/
|
26 |
+
function xt_delete_terms_form_process( $data ) {
|
27 |
+
$error = array();
|
28 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
29 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
30 |
+
}
|
31 |
+
if( $data['delete_post_type'] == '' || $data['post_taxonomy'] == '' ){
|
32 |
+
$error[] = esc_html__('Please select required fields for proceed delete operation.', 'wp-bulk-delete' );
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( !isset( $data['_delete_terms_wpnonce'] ) || !wp_verify_nonce( $data['_delete_terms_wpnonce'], 'delete_terms_nonce' ) ) {
|
36 |
+
wp_die( esc_html__( 'Sorry, Your nonce did not verify.', 'wp-bulk-delete' ) );
|
37 |
+
}
|
38 |
+
|
39 |
+
if( empty( $error ) ){
|
40 |
+
|
41 |
+
$term_count = wpbulkdelete()->api->do_delete_terms( $data );
|
42 |
+
if( false === $term_count ){
|
43 |
+
return array(
|
44 |
+
'status' => 0,
|
45 |
+
'messages' => array( esc_html__( 'Something went wrong pelase try again!!', 'wp-bulk-delete' ) ),
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( ! empty( $term_count ) && $term_count > 0 ) {
|
50 |
+
return array(
|
51 |
+
'status' => 1,
|
52 |
+
'messages' => array( sprintf( esc_html__( '%d Term(s) deleted successfully.', 'wp-bulk-delete' ), $term_count )
|
53 |
+
) );
|
54 |
+
} else {
|
55 |
+
return array(
|
56 |
+
'status' => 1,
|
57 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
} else {
|
62 |
+
return array(
|
63 |
+
'status' => 0,
|
64 |
+
'messages' => $error,
|
65 |
+
);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Render taxonomies for terms.
|
72 |
+
*
|
73 |
+
* @since 1.0
|
74 |
+
* @return void
|
75 |
+
*/
|
76 |
+
function wpbd_render_delete_terms_taxonomy(){?>
|
77 |
+
<tr>
|
78 |
+
<th scope="row">
|
79 |
+
<?php _e('Post Taxonomy :','wp-bulk-delete'); ?>
|
80 |
+
</th>
|
81 |
+
<td>
|
82 |
+
<div class="post_taxonomy">
|
83 |
+
</div>
|
84 |
+
<p class="description">
|
85 |
+
Select the post taxonomy whose terms you want to delete.
|
86 |
+
</p>
|
87 |
+
</td>
|
88 |
+
</tr>
|
89 |
+
<script>
|
90 |
+
jQuery(document).ready(function(){
|
91 |
+
jQuery('#delete_post_type').trigger( 'change' );
|
92 |
+
});
|
93 |
+
</script>
|
94 |
+
<?php
|
95 |
+
}
|
includes/delele-users-form-functions.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Users Form Funcitons
|
4 |
+
*
|
5 |
+
* @package WP_Bulk_Delete
|
6 |
+
* @subpackage Delete Users Form Funcitons
|
7 |
+
* @copyright Copyright (c) 2016, Dharmesh Patel
|
8 |
+
* @since 1.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
// Exit if accessed directly
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
13 |
+
|
14 |
+
/** Actions *************************************************************/
|
15 |
+
add_action( 'wpbd_delete_users_form', 'wpdb_render_delete_users_userroles' );
|
16 |
+
add_action( 'wpbd_delete_users_form', 'wpdb_render_delete_users_usermeta' );
|
17 |
+
add_action( 'wpbd_delete_users_form', 'wpdb_render_delete_users_assignuser' );
|
18 |
+
add_action( 'wpbd_delete_users_form', 'wpdb_render_delete_users_date_interval' );
|
19 |
+
add_action( 'wpbd_delete_users_form', 'wpdb_render_delete_users_limit' );
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Process Delete Users form form
|
23 |
+
*
|
24 |
+
*
|
25 |
+
* @since 1.0
|
26 |
+
* @param array $data Form pot Data.
|
27 |
+
* @return array | posts ID to be delete.
|
28 |
+
*/
|
29 |
+
function xt_delete_users_form_process( $data ) {
|
30 |
+
$error = array();
|
31 |
+
if ( ! current_user_can( 'delete_users' ) ) {
|
32 |
+
$error[] = esc_html__('You don\'t have enough permission for this operation.', 'wp-bulk-delete' );
|
33 |
+
}
|
34 |
+
if( empty( $data['delete_user_roles'] ) && ( $data['user_meta_key'] == '' || $data['user_meta_value'] == '' ) ){
|
35 |
+
$error[] = esc_html__('Please select user role or add usermeta key and value.', 'wp-bulk-delete' );
|
36 |
+
}
|
37 |
+
|
38 |
+
if ( isset( $data['_delete_users_wpnonce'] ) && wp_verify_nonce( $data['_delete_users_wpnonce'], 'delete_users_nonce' ) ) {
|
39 |
+
|
40 |
+
if( empty( $error ) ){
|
41 |
+
|
42 |
+
// Get post_ids for delete based on user input.
|
43 |
+
$user_ids = wpbulkdelete()->api->get_delete_user_ids( $data );
|
44 |
+
if ( ! empty( $user_ids ) && count( $user_ids ) > 0 ) {
|
45 |
+
|
46 |
+
$user_count = wpbulkdelete()->api->do_delete_users( $user_ids );
|
47 |
+
return array(
|
48 |
+
'status' => 1,
|
49 |
+
'messages' => array( sprintf( esc_html__( '%d User(s) deleted successfully.', 'wp-bulk-delete' ), $user_count )
|
50 |
+
) );
|
51 |
+
} else {
|
52 |
+
return array(
|
53 |
+
'status' => 1,
|
54 |
+
'messages' => array( esc_html__( 'Nothing to delete!!', 'wp-bulk-delete' ) ),
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
} else {
|
59 |
+
return array(
|
60 |
+
'status' => 0,
|
61 |
+
'messages' => $error,
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
} else {
|
66 |
+
wp_die( esc_html__( 'Sorry, Your nonce did not verify.', 'wp-bulk-delete' ) );
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Render Userroles checkboxes.
|
72 |
+
*
|
73 |
+
* @since 1.0
|
74 |
+
* @return void
|
75 |
+
*/
|
76 |
+
function wpdb_render_delete_users_userroles(){
|
77 |
+
$userroles = count_users();
|
78 |
+
?>
|
79 |
+
<tr>
|
80 |
+
<th scope="row">
|
81 |
+
<?php _e( 'User roles', 'wp-bulk-delete' ); ?> :
|
82 |
+
</th>
|
83 |
+
<td>
|
84 |
+
<?php
|
85 |
+
if( ! empty( $userroles['avail_roles'] ) ){
|
86 |
+
foreach ($userroles['avail_roles'] as $userrole => $count ) {
|
87 |
+
?>
|
88 |
+
<input name="delete_user_roles[]" class="delete_user_roles" id="user_role_<?php echo $userrole; ?>" type="checkbox" value="<?php echo $userrole; ?>" >
|
89 |
+
<label for="user_role_<?php echo $userrole; ?>">
|
90 |
+
<?php echo $userrole . ' ' . sprintf( __( '( %s Users )', 'wp-bulk-delete' ), $count ); ?>
|
91 |
+
</label><br/>
|
92 |
+
<?php
|
93 |
+
}
|
94 |
+
}
|
95 |
+
?>
|
96 |
+
<p class="description">
|
97 |
+
<?php _e('Select the user roles from which you want to delete users.','wp-bulk-delete'); ?>
|
98 |
+
</p>
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<?php
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Render Userroles checkboxes.
|
107 |
+
*
|
108 |
+
* @since 1.0
|
109 |
+
* @return void
|
110 |
+
*/
|
111 |
+
function wpdb_render_delete_users_usermeta(){
|
112 |
+
?>
|
113 |
+
<tr>
|
114 |
+
<th scope="row">
|
115 |
+
<?php _e('User Meta','wp-bulk-delete'); ?> :
|
116 |
+
</th>
|
117 |
+
<td>
|
118 |
+
<?php esc_html_e( 'User Meta Key', 'wp-bulk-delete' ); ?>
|
119 |
+
<input type="text" id="sample1" name="sample1" class="sample1" placeholder="meta_key" disabled="disabled"/>
|
120 |
+
<select name="sample2" disabled="disabled" >
|
121 |
+
<option value="equal_to_str"><?php esc_html_e( 'equal to ( string )', 'wp-bulk-delete' ); ?></option>
|
122 |
+
</select>
|
123 |
+
<?php esc_html_e( 'Value', 'wp-bulk-delete' ); ?>
|
124 |
+
<input type="text" id="sample3" name="sample3" class="sample3" placeholder="meta_value" disabled="disabled" /><br/>
|
125 |
+
<?php do_action( 'wpbd_display_available_in_pro'); ?>
|
126 |
+
</td>
|
127 |
+
</tr>
|
128 |
+
<?php
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Render User registration date interval.
|
133 |
+
*
|
134 |
+
* @since 1.0
|
135 |
+
* @return void
|
136 |
+
*/
|
137 |
+
function wpdb_render_delete_users_date_interval(){
|
138 |
+
?>
|
139 |
+
<tr>
|
140 |
+
<th scope="row">
|
141 |
+
<?php _e('User Registration Date :','wp-bulk-delete'); ?>
|
142 |
+
</th>
|
143 |
+
<td>
|
144 |
+
<input type="text" id="delete_start_date" name="delete_start_date" class="delete_all_datepicker" placeholder="Start date" />
|
145 |
+
-
|
146 |
+
<input type="text" id="delete_end_date" name="delete_end_date" class="delete_all_datepicker" placeholder="End date" />
|
147 |
+
<p class="description">
|
148 |
+
<?php _e('Set the reigration date interval for users to delete ( only delete users register between these dates ) or leave these fields blank to select all users. The dates must be specified in the following format: <strong>YYYY-MM-DD</strong>','wp-bulk-delete'); ?>
|
149 |
+
</p>
|
150 |
+
</td>
|
151 |
+
</tr>
|
152 |
+
<?php
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Render User delete limit.
|
157 |
+
*
|
158 |
+
* @since 1.0
|
159 |
+
* @return void
|
160 |
+
*/
|
161 |
+
function wpdb_render_delete_users_limit(){
|
162 |
+
?>
|
163 |
+
<tr>
|
164 |
+
<th scope="row">
|
165 |
+
<?php _e('Limit :','wp-bulk-delete'); ?>
|
166 |
+
</th>
|
167 |
+
<td>
|
168 |
+
<input type="number" min="1" id="limit_user" name="limit_user" class="limit_user_input" />
|
169 |
+
<p class="description">
|
170 |
+
<?php _e('Set the limit over user delete. It will delete only first limited users. This option will help you in case of you have lots of users to delete and script timeout.','wp-bulk-delete'); ?>
|
171 |
+
</p>
|
172 |
+
</td>
|
173 |
+
</tr>
|
174 |
+
<?php
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Render Users Dropdown for assign user.
|
179 |
+
*
|
180 |
+
* @since 1.1
|
181 |
+
* @return void
|
182 |
+
*/
|
183 |
+
function wpdb_render_delete_users_assignuser(){
|
184 |
+
?>
|
185 |
+
<tr>
|
186 |
+
<th scope="row">
|
187 |
+
<?php _e('Assign deleted user\'s data to','wp-bulk-delete'); ?> :
|
188 |
+
</th>
|
189 |
+
<td>
|
190 |
+
<select name="sample_user" disabled="disabled">
|
191 |
+
<option value=""> <?php esc_attr_e( 'Select User','wp-bulk-delete')?></option>
|
192 |
+
</select>
|
193 |
+
<p class="description">
|
194 |
+
<?php _e('Select user to whom you want to assign deleted user\'s data.','wp-bulk-delete'); ?>
|
195 |
+
</p>
|
196 |
+
<?php do_action( 'wpbd_display_available_in_pro'); ?>
|
197 |
+
</td>
|
198 |
+
</tr>
|
199 |
+
<?php
|
200 |
+
|
201 |
+
}
|
includes/scripts.php
CHANGED
@@ -23,8 +23,8 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
23 |
*/
|
24 |
function wpbd_enqueue_admin_scripts( $hook ) {
|
25 |
|
26 |
-
$js_dir =
|
27 |
-
wp_register_script( 'wp-bulk-delete', $js_dir . 'wp-bulk-delete-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'),
|
28 |
wp_enqueue_script( 'wp-bulk-delete' );
|
29 |
|
30 |
}
|
@@ -40,8 +40,9 @@ function wpbd_enqueue_admin_scripts( $hook ) {
|
|
40 |
*/
|
41 |
function wpbd_enqueue_admin_styles( $hook ) {
|
42 |
|
43 |
-
$css_dir =
|
44 |
wp_enqueue_style('jquery-ui', $css_dir . 'jquery-ui.css', false, "1.12.0" );
|
|
|
45 |
}
|
46 |
|
47 |
add_action( 'admin_enqueue_scripts', 'wpbd_enqueue_admin_scripts' );
|
23 |
*/
|
24 |
function wpbd_enqueue_admin_scripts( $hook ) {
|
25 |
|
26 |
+
$js_dir = WPBD_PLUGIN_URL . 'assets/js/';
|
27 |
+
wp_register_script( 'wp-bulk-delete', $js_dir . 'wp-bulk-delete-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), WPBD_VERSION );
|
28 |
wp_enqueue_script( 'wp-bulk-delete' );
|
29 |
|
30 |
}
|
40 |
*/
|
41 |
function wpbd_enqueue_admin_styles( $hook ) {
|
42 |
|
43 |
+
$css_dir = WPBD_PLUGIN_URL . 'assets/css/';
|
44 |
wp_enqueue_style('jquery-ui', $css_dir . 'jquery-ui.css', false, "1.12.0" );
|
45 |
+
wp_enqueue_style('wp-bulk-delete-css', $css_dir . 'wp-bulk-delete-admin.css', false, "" );
|
46 |
}
|
47 |
|
48 |
add_action( 'admin_enqueue_scripts', 'wpbd_enqueue_admin_scripts' );
|
wp-bulk-delete.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Plugin Name: WP Bulk Delete
|
4 |
* Plugin URI: http://xylusthemes.com/plugins/wp-bulk-delete/
|
5 |
-
* Description:
|
6 |
-
* Version: 1.
|
7 |
* Author: Xylus Themes
|
8 |
* Author URI: http://xylusthemes.com
|
9 |
* License: GPL-2.0+
|
@@ -91,27 +91,27 @@ class WP_Bulk_Delete{
|
|
91 |
private function setup_constants() {
|
92 |
|
93 |
// Plugin version.
|
94 |
-
if( ! defined( '
|
95 |
-
define( '
|
96 |
}
|
97 |
|
98 |
// Plugin folder Path.
|
99 |
-
if( ! defined( '
|
100 |
-
define( '
|
101 |
}
|
102 |
|
103 |
// Plugin folder URL.
|
104 |
-
if( ! defined( '
|
105 |
-
define( '
|
106 |
}
|
107 |
|
108 |
// Plugin root file.
|
109 |
-
if( ! defined( '
|
110 |
-
define( '
|
111 |
}
|
112 |
// Pro plugin Buy now Link.
|
113 |
-
if( ! defined( '
|
114 |
-
define( '
|
115 |
}
|
116 |
}
|
117 |
|
@@ -123,18 +123,24 @@ class WP_Bulk_Delete{
|
|
123 |
* @return void
|
124 |
*/
|
125 |
private function includes() {
|
126 |
-
|
127 |
-
require_once
|
128 |
-
require_once
|
129 |
-
require_once
|
130 |
-
require_once
|
131 |
-
require_once
|
132 |
-
require_once
|
133 |
-
require_once
|
134 |
-
require_once
|
135 |
-
require_once
|
136 |
-
require_once
|
137 |
-
require_once
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
/**
|
@@ -149,7 +155,7 @@ class WP_Bulk_Delete{
|
|
149 |
load_plugin_textdomain(
|
150 |
'wp-bulk-delete',
|
151 |
false,
|
152 |
-
|
153 |
);
|
154 |
|
155 |
}
|
2 |
/**
|
3 |
* Plugin Name: WP Bulk Delete
|
4 |
* Plugin URI: http://xylusthemes.com/plugins/wp-bulk-delete/
|
5 |
+
* Description: Bulk delete and cleanup anything like posts, comments, users, meta fields, taxonomy terms. with powerful filter options.
|
6 |
+
* Version: 1.1.0
|
7 |
* Author: Xylus Themes
|
8 |
* Author URI: http://xylusthemes.com
|
9 |
* License: GPL-2.0+
|
91 |
private function setup_constants() {
|
92 |
|
93 |
// Plugin version.
|
94 |
+
if( ! defined( 'WPBD_VERSION' ) ){
|
95 |
+
define( 'WPBD_VERSION', '1.0.0' );
|
96 |
}
|
97 |
|
98 |
// Plugin folder Path.
|
99 |
+
if( ! defined( 'WPBD_PLUGIN_DIR' ) ){
|
100 |
+
define( 'WPBD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
101 |
}
|
102 |
|
103 |
// Plugin folder URL.
|
104 |
+
if( ! defined( 'WPBD_PLUGIN_URL' ) ){
|
105 |
+
define( 'WPBD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
106 |
}
|
107 |
|
108 |
// Plugin root file.
|
109 |
+
if( ! defined( 'WPBD_PLUGIN_FILE' ) ){
|
110 |
+
define( 'WPBD_PLUGIN_FILE', __FILE__ );
|
111 |
}
|
112 |
// Pro plugin Buy now Link.
|
113 |
+
if( ! defined( 'WPBD_PLUGIN_BUY_NOW_URL' ) ){
|
114 |
+
define( 'WPBD_PLUGIN_BUY_NOW_URL', 'http://xylusthemes.com/plugins/wp-bulk-delete/?utm_source=insideplugin&utm_medium=web&utm_content=sidebar&utm_campaign=freeplugin' );
|
115 |
}
|
116 |
}
|
117 |
|
123 |
* @return void
|
124 |
*/
|
125 |
private function includes() {
|
126 |
+
require_once WPBD_PLUGIN_DIR . 'includes/scripts.php';
|
127 |
+
require_once WPBD_PLUGIN_DIR . 'includes/class-delete-api.php';
|
128 |
+
require_once WPBD_PLUGIN_DIR . 'includes/common-functions.php';
|
129 |
+
require_once WPBD_PLUGIN_DIR . 'includes/ajax-functions.php';
|
130 |
+
require_once WPBD_PLUGIN_DIR . 'includes/delele-posts-form-functions.php';
|
131 |
+
require_once WPBD_PLUGIN_DIR . 'includes/delele-users-form-functions.php';
|
132 |
+
require_once WPBD_PLUGIN_DIR . 'includes/delele-comments-form-functions.php';
|
133 |
+
require_once WPBD_PLUGIN_DIR . 'includes/delele-meta-form-functions.php';
|
134 |
+
require_once WPBD_PLUGIN_DIR . 'includes/delele-terms-form-functions.php';
|
135 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/admin-pages.php';
|
136 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/admin-sidebar.php';
|
137 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/posts/display-delete-posts.php';
|
138 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/comments/display-delete-comments.php';
|
139 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/users/display-delete-users.php';
|
140 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/meta/display-delete-meta.php';
|
141 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/terms/display-delete-terms.php';
|
142 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/cleanup/cleanup-form.php';
|
143 |
+
require_once WPBD_PLUGIN_DIR . 'includes/admin/cleanup/cleanup-page.php';
|
144 |
}
|
145 |
|
146 |
/**
|
155 |
load_plugin_textdomain(
|
156 |
'wp-bulk-delete',
|
157 |
false,
|
158 |
+
WPBD_PLUGIN_DIR . '/languages/'
|
159 |
);
|
160 |
|
161 |
}
|