[wp-hackers] wp_list_authors and DB queries
Christine Davis
christine at neato.co.nz
Thu Nov 22 03:32:23 GMT 2007
Did you put the order by after the group by?
On 11/22/07, Bob <wp-hackers at nj-arp.org> wrote:
>
> > Couldnt you just add
> > ORDER BY display_name
> > to the SQL Query?
>
> No. I tried. It seems the GROUP BY is doing a sort, so you can't tell it
> to sort via ORDER BY.
>
> It did give me a pretty SQL error message in my sidebar, however. ;-)
>
>
>
> ----- Original Message -----
> From: "DD32" <wordpress at dd32.id.au>
> To: <wp-hackers at lists.automattic.com>
> Sent: Wednesday, November 21, 2007 10:22 PM
> Subject: Re: [wp-hackers] wp_list_authors and DB queries
>
>
> > Couldnt you just add
> > ORDER BY display_name
> > to the SQL Query?
> >
> > On Thu, 22 Nov 2007 14:19:59 +1100, Bob <wp-hackers at nj-arp.org> wrote:
> >
> >> OK, I threw in a sort of the array. Here's the user-defined function
> to
> >> do
> >> the comparison:
> >>
> >> function wp_widget_authors_cmp($a, $b) {
> >> $al = strtolower($a->display_name);
> >> $bl = strtolower($b->display_name);
> >> if ($al == $bl) {
> >> return 0;
> >> }
> >> return ($al < $bl) ? -1 : 1;
> >> }
> >>
> >>
> >> And the call to usort just before the foreach ($authors as $author):
> >>
> >> usort($authors, "wp_widget_authors_cmp");
> >>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list