Warning: This function has been deprecated. Use bbp_switch_to_site() instead.

_bbp_reinit_dynamic_roles( array $roles = array() )

This is necessary because in a few places (noted below) WordPress initializes a blog’s roles directly from the database option. When this happens, the $wp_roles global gets flushed, causing a user to magically lose any dynamically assigned roles or capabilities when $current_user in refreshed.

Description Description

Because dynamic multiple roles is a new concept in WordPress, we work around it here for now, knowing that improvements will come to WordPress core later.

Also note that if using the $wp_user_roles global non-database approach, bbPress does not have an intercept point to add its dynamic roles.

See also See also

Top ↑

Parameters Parameters



Default value: array()

Top ↑

Return Return

(array) Combined array of database roles and dynamic bbPress roles

Top ↑

Source Source

File: includes/core/capabilities.php

function _bbp_reinit_dynamic_roles( $roles = array() ) {
	foreach ( bbp_get_dynamic_roles() as $role_id => $details ) {
		$roles[ $role_id ] = $details;
	return $roles;

Top ↑

Changelog Changelog

Version Description
2.6.0 bbPress (r6105)
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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