bbp_map_caps_to_wp_roles()

Map forum capabilities to WP roles

Description

Source

File: bp-forums/core/capabilities.php

560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
function bbp_map_caps_to_wp_roles() {
    $wp_bbp_role_map = [
        'administrator' => 'bbp_keymaster',
        'editor'        => 'bbp_moderator',
    ];
 
    foreach ( $wp_bbp_role_map as $wp_role => $bbp_role ) {
        $wp_role_object = get_role( $wp_role );
 
        if ( empty( $wp_role_object ) ) // check if role exists if not then continue
            continue;
 
        $bbp_caps = bbp_get_caps_for_role( $bbp_role );
 
        foreach ( array_keys( $bbp_caps ) as $cap) {
            $wp_role_object->add_cap($cap);
        }
    }
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.