bp_get_caps_for_role( string $role = '' )

Return an array of capabilities based on the role that is being requested.

Description

Parameters

$role

(string) (Optional) The role for which you're loading caps.

Default value: ''

Return

(array) Capabilities for $role.

Source

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

function bp_get_caps_for_role( $role = '' ) {

	// Which role are we looking for?
	switch ( $role ) {

		// Administrator.
		case 'administrator' :
			$caps = array(
				// Misc.
				'bp_moderate',
			);

			break;

		// All other default WordPress blog roles.
		case 'editor'      :
		case 'author'      :
		case 'contributor' :
		case 'subscriber'  :
		default            :
			$caps = array();
			break;
	}

	/**
	 * Filters the array of capabilities based on the role that is being requested.
	 *
	 * @since BuddyPress 1.6.0
	 *
	 * @param array  $caps Array of capabilities to return.
	 * @param string $role The role currently being loaded.
	 */
	return apply_filters( 'bp_get_caps_for_role', $caps, $role );
}

Changelog

Changelog
Version Description
BuddyPress 1.6.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.