Skip to:
Content

bbPress.org

Changeset 4168


Ignore:
Timestamp:
08/24/2012 07:43:39 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Capabilities:

  • Remove negative 'blocked' cap and use positive 'participate' cap instead.
  • Replaces old 'bbp_participant' role nicely.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-core-caps.php

    r4165 r4168  
    6767 */
    6868function bbp_get_general_capabilities() {
    69     return apply_filters( 'bbp_get_general_capabilities', array(
     69    return apply_filters( 'bbp_get_general_capabilities', array(
     70        'participate',
    7071        'moderate',
    7172        'throttle',
    7273        'view_trash',
    73         'bozo',
    74         'blocked'
     74        'bozo'
    7575    ) );
    7676}
     
    8484 */
    8585function bbp_get_forums_capabilities() {
    86     return apply_filters( 'bbp_get_forums_capabilities', array( 
     86    return apply_filters( 'bbp_get_forums_capabilities', array(
    8787        'publish_forums',
    8888        'edit_forums',
     
    103103 */
    104104function bbp_get_topics_capabilities() {
    105     return apply_filters( 'bbp_get_topics_capabilities', array( 
     105    return apply_filters( 'bbp_get_topics_capabilities', array(
    106106        'publish_topics',
    107107        'edit_topics',
     
    121121 */
    122122function bbp_get_topic_tags_capabilities() {
    123     return apply_filters( 'bbp_get_topic_tags_capabilities', array( 
     123    return apply_filters( 'bbp_get_topic_tags_capabilities', array(
    124124        'manage_topic_tags',
    125125        'edit_topic_tags',
     
    137137 */
    138138function bbp_get_replies_capabilities() {
    139     return apply_filters( 'bbp_get_replies_capabilities', array( 
     139    return apply_filters( 'bbp_get_replies_capabilities', array(
    140140        'publish_replies',
    141141        'edit_replies',
     
    221221
    222222            // Misc
     223            case 'participate' :
     224                $retval = __( 'Participate in forums', 'bbpress' );
     225                break;
    223226            case 'moderate' :
    224227                $retval = __( 'Moderate entire forum', 'bbpress' );
     
    232235            case 'bozo' :
    233236                $retval = __( 'User is a forum bozo', 'bbpress' );
    234                 break;
    235             case 'blocked' :
    236                 $retval = __( 'User is blocked', 'bbpress' );
    237237                break;
    238238
     
    241241                $retval = __( 'View forum', 'bbpress' );
    242242                break;
    243 
    244243            case 'edit_forum' :
    245244                $retval = __( 'Edit forum', 'bbpress' );
     
    613612function bbp_get_caps_for_role( $role = '' ) {
    614613
    615     // No role
    616     if ( empty( $role ) ) {
    617         $caps = array(
    618             'blocked'
    619         );
    620 
    621614    // Which role are we looking for?
    622     } else {
    623         switch ( $role ) {
    624 
    625             // Administrator
    626             case 'administrator' :
    627 
    628                 $caps = array(
    629 
    630                     // Forum caps
    631                     'publish_forums',
    632                     'edit_forums',
    633                     'edit_others_forums',
    634                     'delete_forums',
    635                     'delete_others_forums',
    636                     'read_private_forums',
    637                     'read_hidden_forums',
    638 
    639                     // Topic caps
    640                     'publish_topics',
    641                     'edit_topics',
    642                     'edit_others_topics',
    643                     'delete_topics',
    644                     'delete_others_topics',
    645                     'read_private_topics',
    646 
    647                     // Reply caps
    648                     'publish_replies',
    649                     'edit_replies',
    650                     'edit_others_replies',
    651                     'delete_replies',
    652                     'delete_others_replies',
    653                     'read_private_replies',
    654 
    655                     // Topic tag caps
    656                     'manage_topic_tags',
    657                     'edit_topic_tags',
    658                     'delete_topic_tags',
    659                     'assign_topic_tags',
    660 
    661                     // Misc
    662                     'moderate',
    663                     'throttle',
    664                     'view_trash'
    665                 );
    666 
    667                 break;
    668 
    669             // Any other role
    670             case 'editor'      :
    671             case 'author'      :
    672             case 'contributor' :
    673             case 'subscriber'  :
    674             default            :
    675                 $caps = array(
    676 
    677                     // Forum caps
    678                     'read_private_forums',
    679 
    680                     // Topic caps
    681                     'publish_topics',
    682                     'edit_topics',
    683 
    684                     // Reply caps
    685                     'publish_replies',
    686                     'edit_replies',
    687 
    688                     // Topic tag caps
    689                     'assign_topic_tags'
    690                 );
    691 
    692                 break;
    693         }
     615    switch ( $role ) {
     616
     617        // Administrator
     618        case 'administrator' :
     619
     620            $caps = array(
     621
     622                // Forum caps
     623                'publish_forums',
     624                'edit_forums',
     625                'edit_others_forums',
     626                'delete_forums',
     627                'delete_others_forums',
     628                'read_private_forums',
     629                'read_hidden_forums',
     630
     631                // Topic caps
     632                'publish_topics',
     633                'edit_topics',
     634                'edit_others_topics',
     635                'delete_topics',
     636                'delete_others_topics',
     637                'read_private_topics',
     638
     639                // Reply caps
     640                'publish_replies',
     641                'edit_replies',
     642                'edit_others_replies',
     643                'delete_replies',
     644                'delete_others_replies',
     645                'read_private_replies',
     646
     647                // Topic tag caps
     648                'manage_topic_tags',
     649                'edit_topic_tags',
     650                'delete_topic_tags',
     651                'assign_topic_tags',
     652
     653                // Misc
     654                'moderate',
     655                'throttle',
     656                'view_trash'
     657            );
     658
     659            break;
     660
     661        // Any other role
     662        case 'editor'      :
     663        case 'author'      :
     664        case 'contributor' :
     665        case 'subscriber'  :
     666        default            :
     667            $caps = array(
     668
     669                // General caps
     670                'participate',
     671
     672                // Forum caps
     673                'read_private_forums',
     674
     675                // Topic caps
     676                'publish_topics',
     677                'edit_topics',
     678
     679                // Reply caps
     680                'publish_replies',
     681                'edit_replies',
     682
     683                // Topic tag caps
     684                'assign_topic_tags'
     685            );
     686
     687            break;
    694688    }
    695689
     
    799793 * @since bbPress (r3944)
    800794 *
     795 * @todo use meta caps and maybe deprecate
    801796 * @uses current_user_can() To check the 'moderate' capability
    802797 * @uses bbp_get_forum_post_type()
Note: See TracChangeset for help on using the changeset viewer.