[wp-trac] [WordPress Trac] #10329: sort_by and count_limit options for wp_list_authors

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 5 20:10:14 UTC 2010


#10329: sort_by and count_limit options for wp_list_authors
-----------------------------+----------------------------------------------
 Reporter:  takaitra         |       Owner:  westi    
     Type:  feature request  |      Status:  reviewing
 Priority:  normal           |   Milestone:  3.1      
Component:  Template         |     Version:           
 Severity:  normal           |    Keywords:  has-patch
-----------------------------+----------------------------------------------

Comment(by t31os_):

 I do find one thing a little strange, and that is, that a function
 designed to list authors actually lists users with any role.

 Although i see why that is, there's no way to query for users with a
 particular role(s), because the capabilities of the user are serialized(so
 there's no room to write this into the SQL query).

 So while we can set hide_empty to false and get users without posts, it
 does not actually distinguish between those that can actually post
 content(has posting capability) and those that can't. I'm not sure how
 that could be worked around, personally i'd see the hide_empty parameter
 dropped if there's no distinction between users that have the ability to
 post, and those that don't.

 I tested the last two patches and they're definately better, but do both
 suffer from a few minor bugs when using particular args in conjunction
 with one another, mincount does not seem to work for me.

 Try this.

 {{{
 wp_list_authors('hide_empty=0&optioncount=1&show_fullname=1&feed=feed&number=10&mincount=2');
 }}}

 Even without the hide_empty, mincount is still ignored with the above.
 I've been varying the args, but in honesty it's not much fun sitting there
 fiddling with args and the results differ slightly between the last 2
 patches.

 One area that could be a problem or even an oversight.
 {{{
 if ( $hide_empty || $min_count || $optioncount || $orderby == 'count' ) {
 }}}
 Then 6 lines down, *inside that condition*.
 {{{
 if ( !$min_count && !$hide_empty )
 }}}
 .. the second condition in some cases can't be met.

 I like the patch by Denis(one query total - no offense intended takaitra),
 because it removes any need to call `get_userdata` which eats up two
 queries per iteration.

 I did actually start writing my own patch following a thread discussion
 that linked to this ticket, but i figured before i go any further, that i
 should examine and test the patches available.

 I've actually done pretty well up till now, had it down to two queries,
 but the patch by Denis put my work to shame(thought i was doing excellent
 at two queries, damn). So i'm going to use the patch Denis submitted as a
 framework and work in some changes. I'd like to submit it here for your
 critique, assuming i've not offended you by now.. :)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10329#comment:27>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list