Usermeta parameters for bp_has_members()
|Reported by:||boonebgorges||Owned by:||boonebgorges|
As I mentioned in IRC, I would like to introduce params to bp_has_members() that will allow filtering by usermeta. See the attached patch for a very basic first pass.
The idea is this: users very frequently have a need to filter member lists based on an arbitrary criteria. (I'd say that over 50% of my projects require this.) The only real way to make this work at the moment is to put filters directly on the SQL query, but for obvious reasons this is not ideal. By adding meta_key and meta_value params to bp_has_members, we allow site builders to manipulate the loop much more efficiently.
The attached patch is a bare-bones approach. Ideally, I would have employed a full meta_query approach, as in WP 3.1 (which would have eased the transition to CPTs in BP 1.4). But that isn't easy to do right now, because of the URL-style querystring method used to pass arguments to bp_has_members(). But there is currently backpat support for meta_value and meta_key params in WP_Meta_Query, so even if we modify the way that these params work in BP 1.4, existing plugins/themes should upgrade pretty seamlessly.