Opened 11 years ago
Closed 11 years ago
#5356 closed enhancement (fixed)
Custom Sort of Group Members
Reported by: | dimensionmedia | Owned by: | |
---|---|---|---|
Milestone: | 2.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Groups | Keywords: | has-patch reporter-feedback |
Cc: |
Description
Boone suggested i create this enhancement ticket based of a question I placed in BP support forums: http://buddypress.org/support/topic/custom-sort-of-group-members/#post-177633
Would like to see a filter on BP_Group_Member_Query::get_group_member_ids() or BP_Group_Member_Query::get_include_ids(). I sometimes want to be able to generate my own logic and db calls to form a list of IDs for a custom sort. A filter would make that possible and would be much appreciated. :)
Thanks!
Attachments (1)
Change History (5)
#2
follow-up:
↓ 3
@
11 years ago
I'd prefer if we didn't add filters directly to the SQL query string - or, at least, if we didn't add filters *only* there. Is there a way that we can build out proper 'order' and 'orderby' support for this method? Then maybe we can just add a filter to the last line:
return apply_filters( 'bp_group_member_query_group_member_ids', $this->group_member_ids );
#3
in reply to:
↑ 2
@
11 years ago
Replying to boonebgorges:
I'd prefer if we didn't add filters directly to the SQL query string - or, at least, if we didn't add filters *only* there. Is there a way that we can build out proper 'order' and 'orderby' support for this method?
No problem :) i thought it was a nice way to be almost sure to get an array or an empty array.
About order, this ticket #921 might be relative, i'll give a new eye on the "old" patch i've suggested for this ticket, i think it can be interesting for 2.0.
Then maybe we can just add a filter to the last line:
return apply_filters( 'bp_group_member_query_group_member_ids', $this->group_member_ids );
Yes that's what i've done at the beginning.
But I think in this case, we should also provide $this->query_vars
or at least $this->query_vars['group_id']
in the filter, so that it's easier to request in the same group
#4
@
11 years ago
- Milestone changed from Awaiting Review to 2.0
- Resolution set to fixed
- Status changed from new to closed
Hi David,
I think the need you shared on this ticket is replied by r7948. So in next version of BuddyPress, you'll be able to filter bp_group_member_query_group_member_ids
in order to get an array of the group members ids and the extra parameter will help you to get the type of sort that was initialy required.
You'll see in r7949 that you can also use the action bp_groups_members_order_options
to add an option to the selectbox used to send the sort preference.
I think we can close this ticket, but if i miss something : i apologise and feel free to reopen the ticket.
see #921 for the full story ;)
Thanks a lot for your contribution
Hi @dimensionmedia
the filter
bp_group_member_query_member_ids_sql
helps you to get (& return) the query, the query parts and the query args.Do you think it can help you in adding your custom sort ?