[buddypress-trac] [BuddyPress] #5032: Sending group invite to member that has requested group membership doesn't work

buddypress-trac noreply at wordpress.org
Fri May 31 15:18:56 UTC 2013

#5032: Sending group invite to member that has requested group membership doesn't
 Reporter:  Mike_Cowobo   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Groups        |    Version:
 Severity:  normal        |   Keywords:  has-patch
 '''Symptom:''' when a group admin invites a user to a group for which the
 user has already requested membership, the user gets notified, but the
 invitation doesn't show up in her group invitations list.

 '''Cause:''' When a user requests group membership,
 `groups_send_membership_request()` creates an entry in the
 `bp_groups_members` table. However, when a group admin sends an invitation
 to this member, `groups_invite_user()` only checks if the user is already
 a member, or already has an invite. It then continues to make a new entry
 in `bp_groups_members`. groups_send_invites next updates the first entry
 (the request) to have invite_sent.

 Result is that when a user looks for his invitations and
 `BP_Groups_Member::get_invites()` is called, the method checks for an
 entry that has an inviter ID and invite sent, and will find nothing.

 Going around and making sure that `groups_send_invites()` updates the
 right entry (by passing in the membership id) won't work, as that will
 simply relocate the problem to `groups_accept_invite()`, which opens the
 first member entry, and confirms member status. If that happens to be the
 membership request, the subsequent call to
 `BP_Groups_Member::check_for_membership_request()` will be false, and we
 end up with a confirmed membership and still a group invite in the table.

 Simplest solution is just to check for an existing membership request when
 a user is invited to a group, and accepting that request instead of going
 through the invitation process (after all, the member has requested
 membership, why ask her again to become a member?)

 The problem is the same the other way around - when a user is invited for
 a group and then requests membership.

 I have attached a patch that does the following:
 - Automatically accept membership request when admin invites a user that
 has requested membership
 - Automatically accept invitation when user requests membership to a group
 she is invited to
 - Show "Group invite accepted" and redirect user when she accepts an
 invite by requesting membership

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5032>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list