Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7501 closed enhancement (fixed)

Add "status" parameter to groups_get_groups().

Reported by: dcavins's profile dcavins Owned by: dcavins's profile dcavins
Milestone: 2.9 Priority: normal
Severity: normal Version: 1.6
Component: Groups Keywords: has-patch
Cc: dcavins

Description

I've been exploring moving toward more granular visibility/access/other properties for groups and a prerequisite is being able to query groups by status or statuses. I think this is a useful improvement to groups_get_groups() on its own, anyway.

I'm attaching a patch that maintains the current behavior (with the show_hidden parameter) and adds the ability to directly fetch groups by status. Please let me know if you have concerns.

Attachments (1)

7501.1.diff (5.6 KB) - added by dcavins 8 years ago.
Fetch groups by status using groups_get_groups().

Download all attachments as: .zip

Change History (7)

#1 @dcavins
8 years ago

  • Owner set to dcavins
  • Status changed from new to accepted

#2 follow-up: @r-a-y
8 years ago

Looks good, but not sure why we would want to support multiple group statuses that are delimited by a space. I would probably remove that and just ask for an array from the get-go if one is querying for multiple statuses.

#3 in reply to: ↑ 2 @dcavins
8 years ago

Replying to r-a-y:

Looks good, but not sure why we would want to support multiple group statuses that are delimited by a space. I would probably remove that and just ask for an array from the get-go if one is querying for multiple statuses.

Thanks for your comments, @r-a-y. I was primarily following our other input filtering that is self-defense against a variety of input types, similarly to how we handle the group_type parameter in groups_get_groups(), which I think was based on how WP does something similar in W_Query: https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/class-wp-query.php#L1943

In any case, I'm OK with accepting the parameter in whatever format is preferred by the team for consistency internally.

Thanks again for taking a look.

@dcavins
8 years ago

Fetch groups by status using groups_get_groups().

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.


8 years ago

#5 @dcavins
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 11532:

Add 'status' parameter to BP_Groups_Group::get().

Add $status parameter to groups_get_groups()` and its underlying
function BP_Groups_Group::get(). Find groups by passing a single
status, a comma-separated list of statuses, or any array of statuses.

Fixes #7501.

#6 @dcavins
8 years ago

  • Milestone changed from Awaiting Review to 2.9
Note: See TracTickets for help on using tickets.