[wp-trac] [WordPress Trac] #15861: Sorting users by post count
WordPress Trac
wp-trac at lists.automattic.com
Fri Aug 19 09:36:11 UTC 2011
#15861: Sorting users by post count
--------------------------------------+-----------------------------
Reporter: scribu | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: needs-patch dev-feedback |
--------------------------------------+-----------------------------
Comment (by SergeyBiryukov):
Replying to [comment:7 nacin]:
> We could potentially do `select post_author from $wpdb->posts where
post_type = 'post' and post_status = 'publish' group by post_author order
by count(ID) desc`, then use that data to sort in PHP.
[attachment:15861.patch] is an attempt to implement this.
Turned out tricky to use proper LIMITs for paging, so I guess this patch
is not scalable. However it should work when querying not only user IDs,
but other fields too (in which case `$this->results` is an array of
objects rather than numbers).
Replying to [ticket:15861 scribu]:
> users is a global table, which might be stored in a separate database.
How exactly can we move users table to a separate database? Perhaps we
should check if it's in the same database and fall back to JOIN, since
it's more simple.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15861#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list