bp_get_caps_for_role( string $role = '' )

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

Description

Parameters

$role

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

Default value: ''

Return

(array) Capabilities for $role.

Source

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

176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
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.