Skip to:
Content

BuddyPress.org

Opened 2 years ago

Last modified 3 months ago

#8794 assigned feature request

Site membership requests: Create/change capability to approve requests

Reported by: leorospo's profile leorospo Owned by: dcavins's profile dcavins
Milestone: Up Next Priority: normal
Severity: normal Version: 11.0.0
Component: Members Keywords: changes-requested 2nd-opinion needs-patch
Cc:

Description

An admin is not able to allow custom roles to approve site membership requests. This might be by design, however it would make sense to allow admins to have granular control over who can access the bp-signups tab in the user screen, and thus allow single users or custom roles to approve the site membership requests.

This can be accomplished by creating a new capability or by using bp_moderate to check for premission. At the moment the functionality is mapped to edit_users, and it might not be desired to allow for that as well.


<?php
// file: class-bp-members-admin.php
// line 109
$this->capability = bp_core_do_network_admin() ? 'manage_network_users' : 'edit_users';

// proposed change
$this->capability = bp_core_do_network_admin() ? 'manage_network_users' : 'bp_moderate';

Attachments (2)

8794-edit-users-cap.1.diff (1.1 KB) - added by dcavins 4 months ago.
BP Members Admin: Use a BP-specific capability which is then mapped to the correct network or single-site edit user cap. This allows plugins to catch and set their own caps for our specific capability.
8794-bp-moderate.1.diff (64.1 KB) - added by dcavins 3 months ago.
Replace generic calls to bp_user_can( 'bp_moderate' ) with more specific capability checks when possible. We fall back to bp_moderate still, but this allows plugins to handle these cases in more specific ways if desired.

Download all attachments as: .zip

Change History (20)

#1 @imath
2 years ago

  • Milestone changed from Awaiting Review to Awaiting Contributions

Hi @leorospo

Thanks for your feedback. Having granular community caps is something we've already thought of. It's a quite complex task but we're open to suggestions and patches or PRs. The bp_moderate might be too broad imho, because we use it a lot into our code base.

Related:
#7176
#5121

#2 @dcavins
2 years ago

  • Component changed from Core to Members
  • Milestone changed from Awaiting Contributions to 12.0.0
  • Owner set to dcavins
  • Status changed from new to assigned

I agree entirely with this, though I'm with @imath that bp_moderate is too broad. Ideally, the cap would be manage_membership_requests and we'll map it to a meta cap (like bp_moderate or edit_users) and leave maximum flexibility. I'm happy to move this logic into a meta_caps filter function.

#3 @imath
2 years ago

Great idea @dcavins let’s do this!

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


19 months ago

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


17 months ago

#6 @imath
17 months ago

  • Milestone changed from 12.0.0 to Up Next

#7 @imath
14 months ago

  • Milestone changed from Up Next to 14.0.0

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


11 months ago

#9 @espellcaste
11 months ago

  • Keywords needs-patch added; has-patch removed

#10 @dcavins
8 months ago

  • Milestone changed from 14.0.0 to Up Next

I'm not going to get this built for v14.

#11 @imath
7 months ago

  • Milestone changed from Up Next to 15.0.0

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


4 months ago

@dcavins
4 months ago

BP Members Admin: Use a BP-specific capability which is then mapped to the correct network or single-site edit user cap. This allows plugins to catch and set their own caps for our specific capability.

@dcavins
3 months ago

Replace generic calls to bp_user_can( 'bp_moderate' ) with more specific capability checks when possible. We fall back to bp_moderate still, but this allows plugins to handle these cases in more specific ways if desired.

#13 @espellcaste
3 months ago

@dcavins Are those patches good for 15? Or should we postpone this ticket?

#14 @dcavins
3 months ago

I can commit the small one tonight. Thanks!

#15 @dcavins
3 months ago

In 14080:

BP Members Admin: Introduce new capability.

BP Members Admin: Use a BP-specific capability for whether a user can manage users and membership requests, which is then mapped to the common network or single-site edit user cap. This allows plugins to catch and set their own caps for our specific capability.

See #8794.

#16 @dcavins
3 months ago

  • Milestone changed from 15.0.0 to Up Next

@espellcaste The second patch is larger and we'll revisit it, so I'll change the version tag. Thanks!

#17 @espellcaste
3 months ago

@dcavins Sounds good. Just to confirm, what's the current status of this ticket? Pending more tests?

#18 @dcavins
3 months ago

Hi Renato, the larger patch is pending a second opinion, really. Thanks!

Note: See TracTickets for help on using tickets.