[buddypress-trac] [BuddyPress] #4483: Allow ASC and DESC sort in bp_has_groups()

buddypress-trac noreply at wordpress.org
Sat May 11 11:41:18 UTC 2013

#4483: Allow ASC and DESC sort in bp_has_groups()
 Reporter:  boonebgorges  |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  new
 Priority:  low           |   Milestone:  1.8
Component:  Groups        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |

Comment (by boonebgorges):

 jkudish - `order` does not appear to be an argument, but a piece of legacy
 code that does nothing. I'll have to do more research into it, but in any
 case it's something that appears to have been broken for a long time.

 I've attached a first pass at `order` and `orderby` support for
 `bp_has_groups()` and the associated stack. Most of it is pretty
 straightforward, but there are a few items to note:

 - In the database class, I've added a few utility methods that convert the
 existing `type` parameter into `order` and `orderby`. When it exists,
 `type` always supercedes `order` and `orderby` - this is primarily for
 backpat, and it also makes `type` useful as a sort of shorthand for
 certain useful combinations of `order` and `orderby`.
 - I've removed the logic in `bp_has_groups()` that sets a default `type`
 of 'active'. This is necessary so that it's possible to actually use
 `order` and `orderby` without also manually setting `type` to false.
 Backward compatibility is maintained, because I made the default values of
 `order` and `orderby` functionally equivalent to `type = active`.

 I've written a number of tests to ensure the new functionality, and to
 make sure that the old behaviors related to the default value of `type`
 continue to work as expected.

 Since this passes all the tests, I'd like to get it into trunk soon (so I
 can start using it, eg, to make columns sortable by ASC and DESC in the
 group admin), but I welcome feedback on the patch first.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4483#comment:4>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list