Skip to:
Content

BuddyPress.org

Opened 17 months ago

Last modified 17 months ago

#8071 new feature request

bp_current_user_can not returning expected results for bp_moderate users

Reported by: Venutius Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

If I assign a user bp_moderate capability, and give then list_users also. The user list does not display the extended profile link as I would expect.

The code that prints this link is in `buddypress/bp-members/classes/class-bp-members-admin.php line 1277:

if ( current_user_can( 'edit_user', $user->ID ) || bp_current_user_can( 'bp_moderate' ) ) { (edit_user typo reported in ticket #8069)

so giving bp_moderate capability to a user should allow that link to be displayed, however it does not.

Tracing this back I can see that wp's user_can will return true for bp_moderate for the administrator, but not for contributor, even though that capability has been added to the role. Is there something else I need to do in order to enable other roles to have bp_moderate?

Change History (1)

#1 @Venutius
17 months ago

  • Type changed from defect (bug) to feature request

I can see that this was a deliberate "temporary" fix back in the day and that _bp_enforce_bp_moderate_cap_for_admins() is intended to ensure only site admin get bp_moderate. That being the case, why have it at all? Why not replace all checks for bp_moderate with edit_options?

Personally I can think of many use cases where I'd want to assign a non-admin to be able to edit the BP side of things so I'd like to see this changed.

Note: See TracTickets for help on using tickets.