diff --git src/wp-admin/users.php src/wp-admin/users.php
index 44d860e..69812d4 100644
|
|
case 'delete': |
211 | 211 | else |
212 | 212 | $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
213 | 213 | |
214 | | $users_posts = new WP_Query( array( |
215 | | 'post_type' => 'any', |
216 | | 'author' => implode( ',', $userids ), |
217 | | 'posts_per_page' => 1 |
218 | | ) ); |
| 214 | global $wpdb; |
| 215 | |
| 216 | $users_posts = $wpdb->get_results( |
| 217 | "SELECT post_author, COUNT(*) as post_count |
| 218 | FROM $wpdb->posts |
| 219 | WHERE post_author IN ( " . implode( ',', $userids ) . " ) |
| 220 | AND post_status = 'publish' OR post_status = 'private' |
| 221 | GROUP BY post_author" |
| 222 | ); |
219 | 223 | |
220 | | if ( $users_posts->have_posts() ) { |
| 224 | if ( ! empty( $users_posts ) ) { |
221 | 225 | add_action( 'admin_head', 'delete_users_add_js' ); |
222 | 226 | } |
223 | 227 | |
… |
… |
case 'delete': |
257 | 261 | </ul> |
258 | 262 | <?php if ( $go_delete ) : |
259 | 263 | |
260 | | if ( ! $users_posts->have_posts() ) : ?> |
| 264 | if ( empty( $users_posts ) ) : ?> |
261 | 265 | <input type="hidden" name="delete_option" value="delete" /> |
262 | 266 | <?php else: ?> |
263 | 267 | <?php if ( 1 == $go_delete ) : ?> |