Make WordPress Core


Ignore:
Timestamp:
08/27/2010 12:18:57 AM (14 years ago)
Author:
scribu
Message:

use get_users() in get_editable_user_ids() and cache result. See #14572

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/user.php

    r15491 r15539  
    435435
    436436        $role = trim( $qv['role'] );
     437
     438        if ( $role || is_multisite() ) {
     439            $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
     440            $this->query_where .= $wpdb->prepare( " AND $wpdb->usermeta.meta_key = %s", $wpdb->prefix . 'capabilities' );
     441        }
     442
    437443        if ( $role ) {
    438             $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
    439             $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $role . '%');
    440         } elseif ( is_multisite() ) {
    441             $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
    442             $this->query_from .= ", $wpdb->usermeta";
    443             $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
     444            $this->query_where .= $wpdb->prepare( " AND $wpdb->usermeta.meta_value LIKE %s", '%' . like_escape( $role ) . '%' );
    444445        }
    445446
Note: See TracChangeset for help on using the changeset viewer.