Skip to:
Content

#7859 closed enhancement (fixed)

Allow querying for all group invitations sent by a user

Reported by: boonebgorges Owned by: boonebgorges
Milestone: 4.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch 2nd-opinion
Cc:

Description

There's currently no way to get a list of all group invitations sent by a user. All methods of querying for invitations sent by a user are pinned to a specific group. We need something more general for #7820.

Related: #6210 cc @dcavins

My initial intuition was to add support to BP_Group_Member_Query, but that class is very heavily tied to a single group ID. So, for the purposes of this ticket and #7820, I'll probably introduce something bespoke, which will be narrow in purpose.

Attachments (2)

7859.diff (1.5 KB) - added by boonebgorges 10 months ago.
7859.2.diff (5.9 KB) - added by boonebgorges 10 months ago.

Download all attachments as: .zip

Change History (6)

@boonebgorges
10 months ago

#1 @boonebgorges
10 months ago

  • Keywords has-patch 2nd-opinion added

7859.diff is a very straightforward but very single-purpose method. (For the real deal I might need to add pagination arguments in order to support batch-processing.)

Obviously, it's not beautiful or desirable to introduce this sort of thing. But I don't see a way of getting the data through one of our existing tools (groups_get_groups(), BP_Group_Member_Query) without extensive and dangerous refactoring, and it feels wasteful to build more robust tools to query this data when such queries are not needed elsewhere in BP at the moment.

@dcavins Your thoughts about this would be valuable. (If you have the spirit, after the tumbleweeds in #6210.)

#2 @dcavins
10 months ago

Hi Boone-

Your proposed function seems fine to me. I'm not crazy about the name, since it's finding all invites of any status, not invites that are "sent," but that's just because the whole invitation lexicon is confusing.

Re #6210, I've recently (last week) had some thoughts about how I can heave it over the finish line. When that happens, we can switch out your new function for the more general purpose fetchers I've built.

Thanks!

#3 @boonebgorges
10 months ago

@dcavins Thanks so much for having a look.

Thinking about this more, I wonder if it might just be better to have a generic "getter" for membership objects - even one that's specific for the purposes of personal data export. This makes it possible to do pagination etc in a way that's consistent across different types of 'memberships'. I'm about to attach a patch that does this.

#4 @boonebgorges
10 months ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 12162:

Introduce BP_Groups_Member::get_user_memberships().

This is a new low-level query method that allows a single syntax for fetching
a paginated set of results from the membership table, for different
values of is_pending, etc. Primarily for use in data exporters; see #7820.

Fixes #7859.

Note: See TracTickets for help on using tickets.