WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4/src/wp-admin/users.php

    r35558 r36106  
    212212        $userids = array_map( 'intval', (array) $_REQUEST['users'] );
    213213
    214     $users_posts = new WP_Query( array(
    215         'post_type' => 'any',
    216         'author' => implode( ',', $userids ),
    217         'posts_per_page' => 1
    218     ) );
    219 
    220     if ( $users_posts->have_posts() ) {
     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    }
     220
     221    if ( $users_have_content ) {
    221222        add_action( 'admin_head', 'delete_users_add_js' );
    222223    }
     
    258259<?php if ( $go_delete ) :
    259260
    260     if ( ! $users_posts->have_posts() ) : ?>
     261    if ( ! $users_have_content ) : ?>
    261262        <input type="hidden" name="delete_option" value="delete" />
    262263    <?php else: ?>
Note: See TracChangeset for help on using the changeset viewer.