[buddypress-trac] [BuddyPress Trac] #8297: The function groups_get_invites_for_user() can return inconsistent total

buddypress-trac noreply at wordpress.org
Wed Oct 7 15:09:56 UTC 2020

#8297: The function groups_get_invites_for_user() can return inconsistent total
 Reporter:  imath         |       Owner:  dcavins
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  7.0.0
Component:  Groups        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |

Comment (by dcavins):

 I double-checked that invitations are removed from the invitations table
 when a group is deleted in the usual way, and they are, via a call to
 `groups_delete_all_group_invites()` in `groups_delete_group()`.

 Regarding the function `groups_get_invites_for_user()`, the
 `groups_get_groups()` call is limited to the groups that the user is
 invited to, found by `groups_get_invited_to_group_ids()`.
 `groups_get_invite_count_for_user()` is just a counting wrapper for
 `return count( groups_get_invited_to_group_ids( $user_id ) )`, so it
 shouldn't incur another db lookup, since the result of
 `groups_get_invited_to_group_ids()` will be cached. It seemed like a good
 source of truth, because `groups_get_invited_to_group_ids()` is the
 original throttle.

 I agree, though, that the "total" number is going to be always accurate if
 it is just the `groups_get_groups['total']` response, because that would
 only return groups that exist, excluding zombie invitations that are left
 over via a hasty db group delete or similar.

 Thanks for opening this ticket!

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8297#comment:6>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list