bbp_filter_blog_editable_roles( array $all_roles = array() )

Removes the bbPress roles from the editable roles array


Description 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 Parameters

$all_roles

(Optional) All registered roles

Default value: array()


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/core/capabilities.php

function bbp_filter_blog_editable_roles( $all_roles = array() ) {

	// Loop through bbPress 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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.