Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/04/2012 02:11:16 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Capabilities:

  • Remove advanced capabilities code, template part, and UI helpers.
  • This has been replaced by the forums roles selection.
  • See #1939.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/capabilities.php

    r4314 r4330  
    1414// Exit if accessed directly
    1515if ( !defined( 'ABSPATH' ) ) exit;
    16 
    17 /**
    18  * Whether or not to show advanced capability editing when editing a user.
    19  *
    20  * @since bbPress (r4290)
    21  *
    22  * @param bool $default
    23  * @return bool
    24  */
    25 function bbp_use_advanced_capability_editor( $default = false ) {
    26     return (bool) apply_filters( 'bbp_use_advanced_capability_editor', $default );
    27 }
    28 
    29 /** Output ********************************************************************/
    30 
    31 /**
    32  * Return the capability groups
    33  *
    34  * @since bbPress (r4163)
    35  *
    36  * @return array of groups
    37  */
    38 function bbp_get_capability_groups() {
    39     return apply_filters( 'bbp_get_capability_groups', array(
    40         'primary',
    41         'forums',
    42         'topics',
    43         'replies',
    44         'topic_tags'
    45     ) );
    46 }
    47 
    48 /**
    49  * Return capabilities for the group
    50  *
    51  * @since bbPress (r4163)
    52  *
    53  * @param string $group
    54  * @return array of capabilities
    55  */
    56 function bbp_get_capabilities_for_group( $group = '' ) {
    57     switch ( $group ) {
    58         case 'primary'    :
    59             return bbp_get_primary_capabilities();
    60             break;
    61         case 'forums'     :
    62             return bbp_get_forums_capabilities();
    63             break;
    64         case 'topics'     :
    65             return bbp_get_topics_capabilities();
    66             break;
    67         case 'replies'    :
    68             return bbp_get_replies_capabilities();
    69             break;
    70         case 'topic_tags' :
    71             return bbp_get_topic_tags_capabilities();
    72             break;
    73         default :
    74             return array();
    75             break;
    76     }
    77 }
    78 
    79 /**
    80  * Output the human readable capability group title
    81  *
    82  * @since bbPress (r4163)
    83  *
    84  * @param string $group
    85  * @uses bbp_get_capability_group_title()
    86  */
    87 function bbp_capability_group_title( $group = '' ) {
    88     echo bbp_get_capability_group_title( $group );
    89 }
    90     /**
    91      * Return the human readable capability group title
    92      *
    93      * @since bbPress (r4163)
    94      *
    95      * @param string $group
    96      * @return string
    97      */
    98     function bbp_get_capability_group_title( $group = '' ) {
    99 
    100         // Default return value to capability group
    101         $retval = $group;
    102 
    103         switch( $group ) {
    104             case 'primary' :
    105                 $retval = __( 'Primary capabilities', 'bbpress' );
    106                 break;
    107             case 'forums' :
    108                 $retval = __( 'Forum capabilities', 'bbpress' );
    109                 break;
    110             case 'topics' :
    111                 $retval = __( 'Topic capabilites', 'bbpress' );
    112                 break;
    113             case 'topic_tags' :
    114                 $retval = __( 'Topic tag capabilities', 'bbpress' );
    115                 break;
    116             case 'replies' :
    117                 $retval = __( 'Reply capabilities', 'bbpress' );
    118                 break;
    119         }
    120 
    121         return apply_filters( 'bbp_get_capability_group_title', $retval, $group );
    122     }
    123 
    124 /**
    125  * Output the human readable capability title
    126  *
    127  * @since bbPress (r4163)
    128  *
    129  * @param string $group
    130  * @uses bbp_get_capability_title()
    131  */
    132 function bbp_capability_title( $capability = '' ) {
    133     echo bbp_get_capability_title( $capability );
    134 }
    135     /**
    136      * Return the human readable capability title
    137      *
    138      * @since bbPress (r4163)
    139      *
    140      * @param string $capability
    141      * @return string
    142      */
    143     function bbp_get_capability_title( $capability = '' ) {
    144 
    145         // Default return value to capability
    146         $retval = $capability;
    147 
    148         switch( $capability ) {
    149 
    150             // Primary
    151             case 'spectate' :
    152                 $retval = __( 'Spectate forum discussion', 'bbpress' );
    153                 break;
    154             case 'participate' :
    155                 $retval = __( 'Participate in forums', 'bbpress' );
    156                 break;
    157             case 'moderate' :
    158                 $retval = __( 'Moderate entire forum', 'bbpress' );
    159                 break;
    160             case 'throttle' :
    161                 $retval = __( 'Skip forum throttle check', 'bbpress' );
    162                 break;
    163             case 'view_trash' :
    164                 $retval = __( 'View items in forum trash', 'bbpress' );
    165                 break;
    166 
    167             // Forum caps
    168             case 'read_forum' :
    169                 $retval = __( 'View forum', 'bbpress' );
    170                 break;
    171             case 'edit_forum' :
    172                 $retval = __( 'Edit forum', 'bbpress' );
    173                 break;
    174             case 'trash_forum' :
    175                 $retval = __( 'Trash forum', 'bbpress' );
    176                 break;
    177             case 'delete_forum' :
    178                 $retval = __( 'Delete forum', 'bbpress' );
    179                 break;
    180             case 'moderate_forum' :
    181                 $retval = __( 'Moderate forum', 'bbpress' );
    182                 break;
    183             case 'publish_forums' :
    184                 $retval = __( 'Create forums', 'bbpress' );
    185                 break;
    186             case 'edit_forums' :
    187                 $retval = __( 'Edit their own forums', 'bbpress' );
    188                 break;
    189             case 'edit_others_forums' :
    190                 $retval = __( 'Edit all forums', 'bbpress' );
    191                 break;
    192             case 'delete_forums' :
    193                 $retval = __( 'Delete their own forums', 'bbpress' );
    194                 break;
    195             case 'delete_others_forums' :
    196                 $retval = __( 'Delete all forums', 'bbpress' );
    197                 break;
    198             case 'read_private_forums' :
    199                 $retval = __( 'View private forums', 'bbpress' );
    200                 break;
    201             case 'read_hidden_forums' :
    202                 $retval = __( 'View hidden forums', 'bbpress' );
    203                 break;
    204 
    205             // Topic caps
    206             case 'read_topic' :
    207                 $retval = __( 'View topic', 'bbpress' );
    208                 break;
    209             case 'edit_topic' :
    210                 $retval = __( 'Edit topic', 'bbpress' );
    211                 break;
    212             case 'trash_topic' :
    213                 $retval = __( 'Trash topic', 'bbpress' );
    214                 break;
    215             case 'moderate_topic' :
    216                 $retval = __( 'Moderate topic', 'bbpress' );
    217                 break;
    218             case 'delete_topic' :
    219                 $retval = __( 'Delete topic', 'bbpress' );
    220                 break;
    221             case 'publish_topics' :
    222                 $retval = __( 'Create topics', 'bbpress' );
    223                 break;
    224             case 'edit_topics' :
    225                 $retval = __( 'Edit their own topics', 'bbpress' );
    226                 break;
    227             case 'edit_others_topics' :
    228                 $retval = __( 'Edit others topics', 'bbpress' );
    229                 break;
    230             case 'delete_topics' :
    231                 $retval = __( 'Delete own topics', 'bbpress' );
    232                 break;
    233             case 'delete_others_topics' :
    234                 $retval = __( 'Delete others topics', 'bbpress' );
    235                 break;
    236             case 'read_private_topics' :
    237                 $retval = __( 'View private topics', 'bbpress' );
    238                 break;
    239 
    240             // Reply caps
    241             case 'read_reply' :
    242                 $retval = __( 'Read reply', 'bbpress' );
    243                 break;
    244             case 'edit_reply' :
    245                 $retval = __( 'Edit reply', 'bbpress' );
    246                 break;
    247             case 'trash_reply' :
    248                 $retval = __( 'Trash reply', 'bbpress' );
    249                 break;
    250             case 'delete_reply' :
    251                 $retval = __( 'Delete reply', 'bbpress' );
    252                 break;
    253             case 'publish_replies' :
    254                 $retval = __( 'Create replies', 'bbpress' );
    255                 break;
    256             case 'edit_replies' :
    257                 $retval = __( 'Edit own replies', 'bbpress' );
    258                 break;
    259             case 'edit_others_replies' :
    260                 $retval = __( 'Edit others replies', 'bbpress' );
    261                 break;
    262             case 'delete_replies' :
    263                 $retval = __( 'Delete own replies', 'bbpress' );
    264                 break;
    265             case 'delete_others_replies' :
    266                 $retval = __( 'Delete others replies', 'bbpress' );
    267                 break;
    268             case 'read_private_replies' :
    269                 $retval = __( 'View private replies', 'bbpress' );
    270                 break;
    271 
    272             // Topic tag caps
    273             case 'manage_topic_tags' :
    274                 $retval = __( 'Remove tags from topics', 'bbpress' );
    275                 break;
    276             case 'edit_topic_tags' :
    277                 $retval = __( 'Edit topic tags', 'bbpress' );
    278                 break;
    279             case 'delete_topic_tags' :
    280                 $retval = __( 'Delete topic tags', 'bbpress' );
    281                 break;
    282             case 'assign_topic_tags' :
    283                 $retval = __( 'Assign tags to topics', 'bbpress' );
    284                 break;
    285         }
    286 
    287         return apply_filters( 'bbp_get_capability_title', $retval, $capability );
    288     }
    28916
    29017/** Mapping *******************************************************************/
Note: See TracChangeset for help on using the changeset viewer.