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

Maps primary capabilities

Description

Parameters

$caps

(Optional) Capabilities for meta capability

Default value: array()

$cap

(Optional) Capability name

Default value: ''

$user_id

(Required) User id

$args

(Optional) Arguments

Default value: array()

Return

(array) Actual capabilities for meta capability

Source

File: bp-forums/users/capabilities.php

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function bbp_map_primary_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
 
    // What capability is being checked?
    switch ( $cap ) {
        case 'spectate'    :
        case 'participate' :
        case 'moderate'    :
 
            // Do not allow inactive users
            if ( bbp_is_user_inactive( $user_id ) ) {
                $caps = array( 'do_not_allow' );
 
            // Moderators are always participants
            } else {
                $caps = array( $cap );
            }
 
            break;
    }
 
    return apply_filters( 'bbp_map_primary_meta_caps', $caps, $cap, $user_id, $args );
}

Changelog

Changelog
Version Description
bbPress (r4242) 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.