~canonical-sysadmins/wordpress/4.4.2

« back to all changes in this revision

Viewing changes to wp-admin/users.php

  • Committer: Barry Price
  • Date: 2016-01-07 06:09:42 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: barry.price@canonical.com-20160107060942-1ghv2tqiwm8z0j36
Merge WP4.4.1 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
        $users_have_content = false;
 
215
        if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
 
216
                $users_have_content = true;
 
217
        } elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
 
218
                $users_have_content = true;
 
219
        }
219
220
 
220
 
        if ( $users_posts->have_posts() ) {
 
221
        if ( $users_have_content ) {
221
222
                add_action( 'admin_head', 'delete_users_add_js' );
222
223
        }
223
224
 
257
258
        </ul>
258
259
<?php if ( $go_delete ) :
259
260
 
260
 
        if ( ! $users_posts->have_posts() ) : ?>
 
261
        if ( ! $users_have_content ) : ?>
261
262
                <input type="hidden" name="delete_option" value="delete" />
262
263
        <?php else: ?>
263
264
                <?php if ( 1 == $go_delete ) : ?>