bbp_get_dynamic_roles()
Fetch a filtered list of forum roles that the current user is allowed to have.
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
(array)
Source
File: bp-forums/core/capabilities.php
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | function bbp_get_dynamic_roles() { return ( array ) apply_filters( 'bbp_get_dynamic_roles' , array ( // Keymaster bbp_get_keymaster_role() => array ( 'name' => 'Keymaster' , 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) ), // Moderator bbp_get_moderator_role() => array ( 'name' => 'Moderator' , 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) ), // Participant bbp_get_participant_role() => array ( 'name' => 'Participant' , 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) ), // Spectator bbp_get_spectator_role() => array ( 'name' => 'Spectator' , 'capabilities' => bbp_get_caps_for_role( bbp_get_spectator_role() ) ), // Blocked bbp_get_blocked_role() => array ( 'name' => 'Blocked' , 'capabilities' => bbp_get_caps_for_role( bbp_get_blocked_role() ) ) ) ); } |
Changelog
Version | Description |
---|---|
bbPress (r4284) | 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.