bbp_restore_caps_from_wp_roles()

Restore forum capabilities from WP roles

Description

Source

File: bp-forums/core/capabilities.php

function bbp_restore_caps_from_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->remove_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.