bbp_get_caps_for_role( string $role = '' )
Returns an array of capabilities based on the role that is being requested.
Description
Parameters
- $role
-
(Optional) Defaults to The role to load caps for
Default value: ''
Return
(array) Capabilities for $role
Source
File: bp-forums/core/capabilities.php
function bbp_get_caps_for_role( $role = '' ) { // Which role are we looking for? switch ( $role ) { // Keymaster case bbp_get_keymaster_role() : $caps = array( // Keymasters only 'keep_gate' => true, // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => true, 'throttle' => true, 'view_trash' => true, // Forum caps 'publish_forums' => true, 'edit_forums' => true, 'edit_others_forums' => true, 'delete_forums' => true, 'delete_others_forums' => true, 'read_private_forums' => true, 'read_hidden_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'edit_others_topics' => true, 'delete_topics' => true, 'delete_others_topics' => true, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => true, 'delete_replies' => true, 'delete_others_replies' => true, 'read_private_replies' => true, // Topic tag caps 'manage_topic_tags' => true, 'edit_topic_tags' => true, 'delete_topic_tags' => true, 'assign_topic_tags' => true ); break; // Moderator case bbp_get_moderator_role() : $caps = array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => true, 'throttle' => true, 'view_trash' => true, // Forum caps 'publish_forums' => true, 'edit_forums' => true, 'read_private_forums' => true, 'read_hidden_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'edit_others_topics' => true, 'delete_topics' => true, 'delete_others_topics' => true, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => true, 'delete_replies' => true, 'delete_others_replies' => true, 'read_private_replies' => true, // Topic tag caps 'manage_topic_tags' => true, 'edit_topic_tags' => true, 'delete_topic_tags' => true, 'assign_topic_tags' => true, ); break; // Spectators can only read case bbp_get_spectator_role() : $caps = array( // Primary caps 'spectate' => true, ); break; // Explicitly blocked case bbp_get_blocked_role() : $caps = array( // Primary caps 'spectate' => false, 'participate' => false, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // Forum caps 'publish_forums' => false, 'edit_forums' => false, 'edit_others_forums' => false, 'delete_forums' => false, 'delete_others_forums' => false, 'read_private_forums' => false, 'read_hidden_forums' => false, // Topic caps 'publish_topics' => false, 'edit_topics' => false, 'edit_others_topics' => false, 'delete_topics' => false, 'delete_others_topics' => false, 'read_private_topics' => false, // Reply caps 'publish_replies' => false, 'edit_replies' => false, 'edit_others_replies' => false, 'delete_replies' => false, 'delete_others_replies' => false, 'read_private_replies' => false, // Topic tag caps 'manage_topic_tags' => false, 'edit_topic_tags' => false, 'delete_topic_tags' => false, 'assign_topic_tags' => false, ); break; // Participant/Default case bbp_get_participant_role() : default : $caps = array( // Primary caps 'spectate' => true, 'participate' => true, // Forum caps 'read_private_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, // Topic tag caps 'assign_topic_tags' => true, ); break; } return apply_filters( 'bbp_get_caps_for_role', $caps, $role ); }
Changelog
Version | Description |
---|---|
bbPress (r2994) | 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.