Warning: This function has been deprecated. Use WP_User::has_cap() instead.

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use WP_User::has_cap() instead.

_bp_enforce_bp_moderate_cap_for_admins( array $caps = array(), string $cap = '', int $user_id, array $args = array() )

Temporary implementation of ‘bp_moderate’ cap.

Description Description

In BuddyPress 1.6, the ‘bp_moderate’ cap was introduced. In order to enforce that bp_current_user_can( ‘bp_moderate’ ) always returns true for Administrators, we must manually add the ‘bp_moderate’ cap to the list of user caps for Admins.

Note that this level of enforcement is only necessary in the case of non-Multisite. This is because WordPress automatically assigns every capability – and thus ‘bp_moderate’ – to Super Admins on a Multisite installation. See WP_User::has_cap().

This implementation of ‘bp_moderate’ is temporary, until BuddyPress properly matches caps to roles and stores them in the database.

Plugin authors: Please do not use this function; thank you. 🙂

See also See also

Top ↑

Parameters Parameters


(Optional) The caps that WP associates with the given role.

Default value: array()


(Optional) The caps being tested for in WP_User::has_cap().

Default value: ''


(Required) ID of the user being checked against.


(Optional) Miscellaneous arguments passed to the user_has_cap filter.

Default value: array()

Top ↑

Return Return

(array) $allcaps The user's cap list, with 'bp_moderate' appended, if relevant.

Top ↑

Source Source

File: bp-core/bp-core-caps.php

function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {

	// Bail if not checking the 'bp_moderate' cap.
	if ( 'bp_moderate' !== $cap ) {
		return $caps;

	// Bail if BuddyPress is not network activated.
	if ( bp_is_network_activated() ) {
		return $caps;

	// Never trust inactive users.
	if ( bp_is_user_inactive( $user_id ) ) {
		return $caps;

	// Only users that can 'manage_options' on this site can 'bp_moderate'.
	return array( 'manage_options' );

Top ↑

Changelog Changelog

Version Description
7.0.0 This function has been deprecated. Use WP_User::has_cap() instead.
1.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.