bbp_filter_blog_editable_roles( array $all_roles = array() )

Removes the Forums roles from the editable roles array

Description

This used to use array_diff_assoc() but it randomly broke before 2.2 release. Need to research what happened, and if there’s a way to speed this up.

Parameters

$all_roles

(Optional) All registered roles

Default value: array()

Return

(array)

Source

File: bp-forums/core/capabilities.php

function bbp_filter_blog_editable_roles( $all_roles = array() ) {

	// Loop through Forums roles
	foreach ( array_keys( bbp_get_dynamic_roles() ) as $bbp_role ) {

		// Loop through WordPress roles
		foreach ( array_keys( $all_roles ) as $wp_role ) {

			// If keys match, unset
			if ( $wp_role === $bbp_role ) {
				unset( $all_roles[$wp_role] );
			}
		}
	}

	return $all_roles;
}

Changelog

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