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-admin/includes/user.php

    r15491 r15539  
    241241 *
    242242 * @param int $user_id User ID.
    243  * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
    244  * @return unknown
    245  */
    246 function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
    247     global $wpdb;
     243 * @param bool $deprecated Not used.
     244 * @return array
     245 */
     246function get_editable_user_ids( $user_id, $deprecated = true, $post_type = 'post' ) {
     247    global $wpdb;
     248
     249    if ( !$deprecated )
     250        _deprecated_argument( __FUNCTION__, '3.1.0' );
    248251
    249252    $user = new WP_User( $user_id );
     
    257260    }
    258261
    259     if ( !is_multisite() )
    260         $level_key = $wpdb->get_blog_prefix() . 'user_level';
    261     else
    262         $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
    263 
    264     $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
    265     if ( $exclude_zeros )
    266         $query .= " AND meta_value != '0'";
    267 
    268     return $wpdb->get_col( $query );
     262    return get_users( array('fields' => 'ids') );
    269263}
    270264
Note: See TracChangeset for help on using the changeset viewer.