bbp_get_dynamic_roles()
Fetch a filtered list of forum roles that the current user is allowed to have.
Description Description
Simple function who’s main purpose is to allow filtering of the list of forum roles so that plugins can remove inappropriate ones depending on the situation or user making edits.
Specifically because without filtering, anyone with the edit_users capability can edit others to be administrators, even if they are only editors or authors. This filter allows admins to delegate user management.
Return Return
(array)
Source Source
File: includes/core/capabilities.php
function bbp_get_dynamic_roles() { // Defaults $to_array = array(); $roles = bbpress()->roles; // Convert WP_Roles objects to arrays foreach ( $roles as $role_id => $wp_role ) { $to_array[ $role_id ] = (array) $wp_role; } // Filter & return return (array) apply_filters( 'bbp_get_dynamic_roles', $to_array, $roles ); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | bbPress (r6117) Use bbpress()->roles |
2.2.0 | Introduced. |