Introduces BP_Group_Member_Query and refactors bp_group_has_members() to use it
BP_Group_Member_Query extends BP_User_Query, which has a number of notable
benefits:
- Group member queries no longer JOIN against global user tables
- Less code duplication, since general logic like 'exclude' is handled by
BP_User_Query
- Future access to the additional parameters of BP_User_Query, such as 'type'
Using the new BP_Group_Member_Query, this changeset also changes the way that
group member queries filter by group roles (member, mod, admin). The new
group_role parameter in the bp_group_has_members() stack accepts an array of
group roles. The legacy argument 'exclude_admins_mods' is still accepted, and
translates to 'group_role' => array( 'member' ) when true. These group_role
enhancements will allow for future enhancements in the Groups Admin section of
the Dashboard, and other places where it might be useful to query for the
members of a group matching a specific role. See #4977.
Fixes #4482
Props trishasalas for early patches and feedback. Props johnjamesjacoby for
review.