Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#6031 closed enhancement (fixed)

Allow `bp_groups_user_can_send_invites()` to accept a user ID

Reported by: dcavins Owned by: r-a-y
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch
Cc:

Description

As it functions now, bp_groups_user_can_send_invites() only tests against the logged-in user. It would be useful in some instances (like when an admin is admin-ing a group) to be able to pass it a user_id to check specifically.

I made this change in #6025 as a necessary change for error-checking in groups_send_invites(), but realize that this may be easier to deal with in a smaller chunk.

Attachments (2)

6031.01.patch (7.6 KB) - added by dcavins 6 years ago.
Add $user_id parameter to bp_groups_user_can_send_invites()
6031.02.patch (3.3 KB) - added by dcavins 6 years ago.
Adds nonmember case to test cases

Download all attachments as: .zip

Change History (8)

@dcavins
6 years ago

Add $user_id parameter to bp_groups_user_can_send_invites()

#1 @DJPaul
6 years ago

  • Milestone changed from Awaiting Review to 2.2

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


6 years ago

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


6 years ago

#4 @r-a-y
6 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 9293:

Add $user_id parameter to bp_groups_user_can_send_invites().

This allows developers to check if a specific user can send group invites
rather than just do checks against the logged-in user.

This commit also:

  • Updates the PHPDoc for the function and the filter hook.
  • Adds unit tests.

Props dcavins.

Fixes #6031.

@dcavins
6 years ago

Adds nonmember case to test cases

#5 @dcavins
6 years ago

Hi r-a-y-

Thanks very much for making improvements to the patch and committing it. Upon reading over the change set, I realized that I had missed a basic test case in the unit tests: non-members.

I've added a patch that covers this case and also tweaks the "current group" test.

Thanks again for sponsoring this patch.

#6 @r-a-y
6 years ago

In 9300:

Tests: Add tests for non-members for bp_groups_user_can_send_invites()

Props dcavins.

See #6031.

Note: See TracTickets for help on using tickets.