﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
17123,WP_User_Query ordered by post_count doesn't work if prefix is not wp_,ziofix,,"If you try this:
{{{
#!php
$q = WP_User_Query( array( 'orderby' => 'post_count' ) );
}}}

it won't work if your table prefix is different than 'wp_', because it's hard coded in wp-includes/user.php line 441 : 

{{{
#!php
$this->query_from .= "" LEFT OUTER JOIN (
  SELECT post_author, COUNT(*) as post_count
  FROM wp_posts
  $where
  GROUP BY post_author
) p ON ({$wpdb->users}.ID = p.post_author)
"";
}}}

it should be replaced by: 

{{{
#!php
$this->query_from .= "" LEFT OUTER JOIN (
  SELECT post_author, COUNT(*) as post_count
  FROM $wpdb->posts
  $where
  GROUP BY post_author
) p ON ({$wpdb->users}.ID = p.post_author)
"";
}}}",defect (bug),closed,normal,3.1.2,Users,3.1,major,fixed,has-patch,
