Skip to:
Content

bbPress.org

Changeset 4222


Ignore:
Timestamp:
09/17/2012 12:03:03 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Capabilities:

  • Remove experimental Bozo functionality. We can use the 'participate' to prevent forum participation without creating topics or replies.
  • Introduce functions to reset, save, and remove user capabilities.
  • Use these functions in both theme-side and admin-side profiles.
  • Add capabilities to bbp-twentyten theme. This will be moved into the stand-alone bbp-twentyten theme soon'ish.
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/bbp-admin/bbp-users.php

    r4219 r4222  
    110110            return;
    111111
    112         // Load up the user
    113         $user = new WP_User( $user_id );
    114 
    115112        // Either reset caps for role
    116113        if ( ! empty( $_POST['bbp-default-caps'] ) ) {
    117 
    118             // Remove all caps
    119             foreach ( bbp_get_capability_groups() as $group ) {
    120                 foreach ( bbp_get_capabilities_for_group( $group ) as $capability ) {
    121                     $user->remove_cap( $capability );
    122                 }
    123             }
     114            bbp_reset_user_caps( $user_id );
    124115
    125116        // Or set caps individually
    126117        } else {
    127 
    128             // Loop through capability groups
    129             foreach ( bbp_get_capability_groups() as $group ) {
    130                 foreach ( bbp_get_capabilities_for_group( $group ) as $capability ) {
    131 
    132                     // Maybe add cap
    133                     if ( ! empty( $_POST['_bbp_' . $capability] ) && ! $user->has_cap( $capability ) ) {
    134                         $user->add_cap( $capability, true );
    135 
    136                     // Maybe remove cap
    137                     } elseif ( empty( $_POST['_bbp_' . $capability] ) && $user->has_cap( $capability ) ) {
    138                         $user->add_cap( $capability, false );
    139                     }
    140                 }
    141             }
     118            bbp_save_user_caps( $user_id );
    142119        }
    143120    }
  • trunk/bbp-includes/bbp-core-caps.php

    r4206 r4222  
    115115        'moderate',
    116116        'throttle',
    117         'view_trash',
    118         'bozo'
     117        'view_trash'
    119118    ) );
    120119}
     
    277276                $retval = __( 'View items in forum trash', 'bbpress' );
    278277                break;
    279             case 'bozo' :
    280                 $retval = __( 'User is a forum bozo', 'bbpress' );
    281                 break;
    282278
    283279            // Forum caps
     
    426422        /** General ***********************************************************/
    427423
    428         case 'bozo' :
    429 
    430             // Inactive users are not bozos
     424        /**
     425         * The 'participate' capability is similar to WordPress's 'read' cap,
     426         * in that it is the minimum required cap to perform any other bbPress
     427         * related thing.
     428         */
     429        case 'participate' :
     430
     431            // Inactive users cannot participate
    431432            if ( bbp_is_user_inactive( $user_id ) ) {
    432433                $caps = array( 'do_not_allow' );
    433434
    434             // Moderators are not bozos
     435            // Moderators are always participants
    435436            } elseif ( user_can( $user_id, 'moderate' ) ) {
     437                $caps = array( $cap );
     438
     439            // Map to read
     440            } else {
     441                $caps = array( 'read' );
     442            }
     443
     444            break;
     445           
     446        case 'moderate' :
     447
     448            // All admins are administrators
     449            if ( user_can( $user_id, 'administrator' ) ) {
     450                $caps = array( 'read' );
     451            }
     452            break;
     453
     454        /** Reading ***********************************************************/
     455
     456        case 'read_private_forums' :
     457        case 'read_hidden_forums'  :
     458
     459            // Non-participants cannot never read private/hidden forums
     460            if ( ! user_can( $user_id, 'participate' ) ) {
    436461                $caps = array( 'do_not_allow' );
    437             }
    438 
    439             break;
    440 
    441         /** Reading ***********************************************************/
     462
     463            // Moderators can always read private/hidden forums
     464            } elseif ( user_can( $user_id, 'moderate' ) ) {
     465                $caps = array( $cap );
     466            }
     467
     468            break;
    442469
    443470        case 'read_forum' :
     
    445472        case 'read_reply' :
    446473
    447             // Get the post
    448             $_post = get_post( $args[0] );
    449             if ( !empty( $_post ) ) {
    450 
    451                 // Get caps for post type object
    452                 $post_type = get_post_type_object( $_post->post_type );
    453                 $caps      = array();
    454 
    455                 // Post is public
    456                 if ( bbp_get_public_status_id() == $_post->post_status ) {
    457                     $caps[] = 'read';
    458 
    459                 // User is author so allow read
    460                 } elseif ( (int) $user_id == (int) $_post->post_author ) {
    461                     $caps[] = 'read';
    462 
    463                 // Unknown so map to private posts
    464                 } else {
    465                     $caps[] = $post_type->cap->read_private_posts;
     474            // User cannot participate
     475            if ( ! user_can( $user_id, 'participate' ) ) {
     476                $caps = array( 'do_not_allow' );
     477
     478            // Do some post ID based logic
     479            } else {
     480           
     481                // Get the post
     482                $_post = get_post( $args[0] );
     483                if ( !empty( $_post ) ) {
     484
     485                    // Get caps for post type object
     486                    $post_type = get_post_type_object( $_post->post_type );
     487
     488                    // Post is public
     489                    if ( bbp_get_public_status_id() == $_post->post_status ) {
     490                        $caps = array( 'particpate' );
     491
     492                    // User is author so allow read
     493                    } elseif ( (int) $user_id == (int) $_post->post_author ) {
     494                        $caps = array( 'participate' );
     495
     496                    // Unknown so map to private posts
     497                    } else {
     498                        $caps = array( $post_type->cap->read_private_forums );
     499                    }
    466500                }
    467501            }
     
    475509        case 'publish_replies' :
    476510
    477             // Add do_not_allow cap if user is spam or deleted
    478             if ( bbp_is_user_inactive( $user_id ) )
     511            // Non participants cannot participate
     512            if ( ! user_can( $user_id, 'participate' ) ) {
    479513                $caps = array( 'do_not_allow' );
    480514
     515            // Moderators can always edit
     516            } elseif ( user_can( $user_id, 'moderate' ) ) {
     517                $caps = array( $cap );
     518            }
     519
    481520            break;
    482521
     
    484523
    485524        // Used primarily in wp-admin
    486         case 'edit_forums' :
    487         case 'edit_topics' :
    488         case 'edit_replies' :
    489 
    490             // Add do_not_allow cap if user is spam or deleted
    491             if ( bbp_is_user_inactive( $user_id ) )
     525        case 'edit_forums'         :
     526        case 'edit_topics'         :
     527        case 'edit_replies'        :
     528        case 'edit_others_topics'  :
     529        case 'edit_others_replies' :
     530
     531            // Moderators can always edit
     532            if ( ! user_can( $user_id, 'participate' ) ) {
    492533                $caps = array( 'do_not_allow' );
     534
     535            // Moderators can always edit forum content
     536            } elseif ( user_can( $user_id, 'moderate' ) ) {
     537                $caps = array( $cap );
     538            }
    493539
    494540            break;
     
    567613                    $caps[] = 'do_not_allow';
    568614
     615                // Moderators can always edit forum content
     616                } elseif ( user_can( $user_id, 'moderate' ) ) {
     617                    $caps[] = 'participate';
     618
    569619                // Unknown so map to delete_others_posts
    570620                } else {
    571621                    $caps[] = $post_type->cap->delete_others_posts;
    572622                }
     623            }
     624
     625            break;
     626           
     627        // Moderation override
     628        case 'delete_topics'         :
     629        case 'delete_replies'        :
     630        case 'delete_others_topics'  :
     631        case 'delete_others_replies' :
     632
     633            // Moderators can always edit
     634            if ( ! user_can( $user_id, 'participate' ) ) {
     635                $caps = array( 'do_not_allow' );
     636
     637            // Moderators can always edit forum content
     638            } elseif ( user_can( $user_id, 'moderate' ) ) {
     639                $caps = array( $cap );
     640            }
     641
     642            break;
     643           
     644        /** Topic Tags ********************************************************/
     645
     646        case 'manage_topic_tags' :
     647        case 'edit_topic_tags'   :
     648        case 'delete_topic_tags' :
     649        case 'assign_topic_tags' :
     650
     651            // Moderators can always edit
     652            if ( ! user_can( $user_id, 'participate' ) ) {
     653                $caps = array( 'do_not_allow' );
     654
     655            // Moderators can always edit forum content
     656            } elseif ( user_can( $user_id, 'moderate' ) ) {
     657                $caps = array( $cap );
    573658            }
    574659
     
    748833
    749834    return apply_filters( 'bbp_get_caps_for_role', $caps, $role );
     835}
     836
     837/**
     838 * Remove all bbPress capabilities for a given user
     839 *
     840 * @since bbPress (r4221)
     841 *
     842 * @param int $user_id
     843 * @return boolean True on success, false on failure
     844 */
     845function bbp_remove_user_caps( $user_id = 0 ) {
     846
     847    // Bail if no user was passed
     848    if ( empty( $user_id ) )
     849        return false;
     850
     851    // Load up the user
     852    $user = new WP_User( $user_id );
     853
     854    // Remove all caps
     855    foreach ( bbp_get_capability_groups() as $group )
     856        foreach ( bbp_get_capabilities_for_group( $group ) as $capability )
     857            $user->remove_cap( $capability );
     858
     859    // Success
     860    return true;
     861}
     862
     863/**
     864 * Remove all bbPress capabilities for a given user
     865 *
     866 * @since bbPress (r4221)
     867 *
     868 * @param int $user_id
     869 * @return boolean True on success, false on failure
     870 */
     871function bbp_reset_user_caps( $user_id = 0 ) {
     872
     873    // Bail if no user was passed
     874    if ( empty( $user_id ) )
     875        return false;
     876
     877    // Bail if not a member of this blog
     878    if ( ! user_can( $user_id, 'read' ) )
     879        return false;
     880
     881    // Remove all caps for user
     882    bbp_remove_user_caps( $user_id );
     883
     884    // Load up the user
     885    $user = new WP_User( $user_id );
     886
     887    // User has no role so bail
     888    if ( ! isset( $user->roles ) )
     889        return false;
     890
     891    // Use first user role
     892    $caps = bbp_get_caps_for_role( array_shift( $user->roles ) );
     893
     894    // Add caps for the first role
     895    foreach ( $caps as $cap )
     896        $user->add_cap( $cap, true );
     897
     898    // Success
     899    return true;
     900}
     901
     902/**
     903 * Save all bbPress capabilities for a given user
     904 *
     905 * @since bbPress (r4221)
     906 *
     907 * @param type $user_id
     908 * @return boolean
     909 */
     910function bbp_save_user_caps( $user_id = 0 ) {
     911
     912    // Bail if no user was passed
     913    if ( empty( $user_id ) )
     914        return false;
     915
     916    // Bail if not a member of this blog
     917    if ( ! user_can( $user_id, 'read' ) )
     918        return false;
     919
     920    // Load up the user
     921    $user = new WP_User( $user_id );
     922
     923    // Loop through capability groups
     924    foreach ( bbp_get_capability_groups() as $group ) {
     925        foreach ( bbp_get_capabilities_for_group( $group ) as $capability ) {
     926
     927            // Maybe add cap
     928            if ( ! empty( $_POST['_bbp_' . $capability] ) && ! $user->has_cap( $capability ) ) {
     929                $user->add_cap( $capability, true );
     930
     931            // Maybe remove cap
     932            } elseif ( empty( $_POST['_bbp_' . $capability] ) && $user->has_cap( $capability ) ) {
     933                $user->add_cap( $capability, false );
     934            }
     935        }
     936    }
     937
     938    // Success
     939    return true;
    750940}
    751941
  • trunk/bbp-includes/bbp-core-functions.php

    r4209 r4222  
    366366}
    367367
    368 /**
    369  * Return the bozo post status ID
    370  *
    371  * @since bbPress (r4167)
    372  *
    373  * @return string
    374  */
    375 function bbp_get_bozo_status_id() {
    376     return bbpress()->bozo_status_id;
    377 }
    378 
    379368/** Rewrite IDs ***************************************************************/
    380369
  • trunk/bbp-includes/bbp-reply-functions.php

    r4218 r4222  
    221221    if ( !bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
    222222        $reply_status = bbp_get_pending_status_id();
    223 
    224     // Maybe set as bozo status
    225     } elseif ( bbp_is_user_bozo() ) {
    226         $reply_status = bbp_get_bozo_status_id();
    227223
    228224    // Default
     
    391387
    392388    // Define local variable(s)
    393     $reply = $reply_id = $topic_id = $forum_id = $anonymous_data = 0;
     389    $reply = $reply_id = $reply_author = $topic_id = $forum_id = $anonymous_data = 0;
    394390    $reply_title = $reply_content = $reply_edit_reason = $terms = '';
    395391
     
    422418
    423419        // Check users ability to create new reply
    424         if ( !bbp_is_reply_anonymous( $reply_id ) ) {
     420        if ( ! bbp_is_reply_anonymous( $reply_id ) ) {
    425421
    426422            // User cannot edit this reply
     
    430426            }
    431427
     428            // Set reply author
     429            $reply_author = bbp_get_reply_author_id( $reply_id );
     430
    432431        // It is an anonymous post
    433432        } else {
     
    494493    /** Reply Blacklist *******************************************************/
    495494
    496     if ( !bbp_check_for_blacklist( $anonymous_data, bbp_get_reply_author_id( $reply_id ), $reply_title, $reply_content ) )
     495    if ( !bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) )
    497496        bbp_add_error( 'bbp_reply_blacklist', __( '<strong>ERROR</strong>: Your reply cannot be edited at this time.', 'bbpress' ) );
    498497
     
    500499
    501500    // Maybe put into moderation
    502     if ( !bbp_check_for_moderation( $anonymous_data, bbp_get_reply_author_id( $reply_id ), $reply_title, $reply_content ) ) {
     501    if ( !bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
    503502        $reply_status = bbp_get_pending_status_id();
    504 
    505     // Maybe set as bozo status
    506     } elseif ( bbp_is_user_bozo() ) {
    507         $reply_status = bbp_get_bozo_status_id();
    508503
    509504    // Default
     
    544539        'post_content' => $reply_content,
    545540        'post_status'  => $reply_status,
    546         'post_parent'  => $reply->post_parent,
    547         'post_author'  => $reply->post_author,
     541        'post_parent'  => $topic_id,
     542        'post_author'  => $reply_author,
    548543        'post_type'    => bbp_get_reply_post_type()
    549544    ) );
     
    589584
    590585        // Update counts, etc...
    591         do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply->post_author , true /* Is edit */ );
     586        do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author , true /* Is edit */ );
    592587
    593588        /** Additional Actions (After Save) ***********************************/
  • trunk/bbp-includes/bbp-reply-template.php

    r4216 r4222  
    4444 *
    4545 * @param mixed $args All the arguments supported by {@link WP_Query}
    46  * @uses bbp_is_user_bozo() To add the bozo post status
    4746 * @uses bbp_show_lead_topic() Are we showing the topic as a lead?
    4847 * @uses bbp_get_topic_id() To get the topic id
     
    7574    }
    7675
    77     // Add the bozo status if user is a bozo
    78     if ( bbp_is_user_bozo() ) {
    79         $post_statuses[] = bbp_get_bozo_status_id();
    80     }
    81 
    8276    $default_reply_search = !empty( $_REQUEST['rs'] ) ? $_REQUEST['rs'] : false;
    8377    $default_post_parent  = ( bbp_is_single_topic() ) ? bbp_get_topic_id() : 'any';
  • trunk/bbp-includes/bbp-topic-functions.php

    r4218 r4222  
    243243    if ( !bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
    244244        $topic_status = bbp_get_pending_status_id();
    245 
    246     // Maybe set as bozo status
    247     } elseif ( bbp_is_user_bozo() ) {
    248         $topic_status = bbp_get_bozo_status_id();
    249245
    250246    // Default to published
     
    438434
    439435    // Define local variable(s)
    440     $topic = $topic_id = $forum_id = $anonymous_data = 0;
     436    $topic = $topic_id = $topic_author = $forum_id = $anonymous_data = 0;
    441437    $topic_title = $topic_content = $topic_edit_reason = '';
    442438
     
    463459
    464460        // Check users ability to create new topic
    465         if ( !bbp_is_topic_anonymous( $topic_id ) ) {
     461        if ( ! bbp_is_topic_anonymous( $topic_id ) ) {
    466462
    467463            // User cannot edit this topic
     
    470466            }
    471467
     468            // Set topic author
     469            $topic_author = bbp_get_topic_author_id( $topic_id );
     470
    472471        // It is an anonymous post
    473472        } else {
     
    550549    /** Topic Blacklist *******************************************************/
    551550   
    552     if ( !bbp_check_for_blacklist( $anonymous_data, bbp_get_topic_author_id( $topic_id ), $topic_title, $topic_content ) )
     551    if ( !bbp_check_for_blacklist( $anonymous_data, $topic_author, $topic_title, $topic_content ) )
    553552        bbp_add_error( 'bbp_topic_blacklist', __( '<strong>ERROR</strong>: Your topic cannot be edited at this time.', 'bbpress' ) );
    554553
     
    558557    if ( !bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
    559558        $topic_status = bbp_get_pending_status_id();
    560 
    561     // Maybe set as bozo status
    562     } elseif ( bbp_is_user_bozo() ) {
    563         $topic_status = bbp_get_bozo_status_id();
    564559
    565560    // Default to published
     
    610605        'post_status'  => $topic_status,
    611606        'post_parent'  => $forum_id,
    612         'post_author'  => $topic->post_author,
     607        'post_author'  => $topic_author,
    613608        'post_type'    => bbp_get_topic_post_type(),
    614609        'tax_input'    => $terms,
     
    664659
    665660        // Update counts, etc...
    666         do_action( 'bbp_edit_topic', $topic_id, $forum_id, $anonymous_data, $topic->post_author , true /* Is edit */ );
     661        do_action( 'bbp_edit_topic', $topic_id, $forum_id, $anonymous_data, $topic_author , true /* Is edit */ );
    667662
    668663        // If the new forum id is not equal to the old forum id, run the
  • trunk/bbp-includes/bbp-topic-template.php

    r4171 r4222  
    6363 * @param mixed $args All the arguments supported by {@link WP_Query}
    6464 * @uses current_user_can() To check if the current user can edit other's topics
    65  * @uses bbp_is_user_bozo() To add the bozo post status
    6665 * @uses bbp_get_topic_post_type() To get the topic post type
    6766 * @uses WP_Query To make query and get the topics
     
    9190    } else {
    9291        $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id() );
    93     }
    94 
    95     // Add the bozo status if user is a bozo
    96     if ( bbp_is_user_bozo() ) {
    97         $post_statuses[] = bbp_get_bozo_status_id();
    9892    }
    9993
  • trunk/bbp-includes/bbp-user-functions.php

    r4196 r4222  
    934934    $edit_user = edit_user( $user_id );
    935935
     936    // Either reset caps for role
     937    if ( ! empty( $_POST['bbp-default-caps'] ) ) {
     938        bbp_reset_user_caps( $user_id );
     939
     940    // Or set caps individually
     941    } else {
     942        bbp_save_user_caps( $user_id );
     943    }
     944
    936945    // Error(s) editng the user, so copy them into the global
    937946    if ( is_wp_error( $edit_user ) ) {
     
    13361345
    13371346/**
    1338  * Checks if user is a bozo.
    1339  *
    1340  * @since bbPress (r4169)
    1341  *
    1342  * @uses is_user_logged_in() To check if user is logged in
    1343  * @uses bbp_get_displayed_user_id() To get current user ID
    1344  * @uses bbp_is_user_active() To check if user is active
    1345  *
    1346  * @param int $user_id The user ID to check. Defaults to current user ID
    1347  * @return bool True if inactive, false if active
    1348  */
    1349 function bbp_is_user_bozo( $user_id = 0 ) {
    1350 
    1351     // Default to current user
    1352     if ( empty( $user_id ) && is_user_logged_in() )
    1353         $user_id = bbp_get_current_user_id();
    1354 
    1355     // Anonymous users are not bozos
    1356     if ( empty( $user_id ) )
    1357         return false;
    1358 
    1359     // Return if a user has the bozo capability
    1360     return (bool) apply_filters( 'bbp_is_user_bozo', user_can( $user_id, 'bozo' ), $user_id );
    1361 }
    1362 
    1363 /**
    13641347 * Return a user's main role
    13651348 *
  • trunk/bbp-includes/bbp-user-template.php

    r4207 r4222  
    449449        } elseif ( user_can( $user_id, 'moderate' ) ) {
    450450            $role = __( 'Moderator', 'bbpress' );
    451 
    452         // Bozo
    453         } elseif ( user_can( $user_id, 'bozo' ) ) {
    454             $role = __( 'Bozo', 'bbpress' );
    455451
    456452        // Participant
  • trunk/bbp-theme-compat/bbpress/form-user-edit.php

    r4196 r4222  
    125125        <div id="password">
    126126            <label for="pass1"><?php _e( 'New Password', 'bbpress' ); ?></label>
    127             <fieldset class="bbp-form">
     127            <fieldset class="bbp-form password">
    128128                <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" tabindex="<?php bbp_tab_index(); ?>" />
    129129                <span class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.', 'bbpress' ); ?></span>
     
    143143    <?php if ( current_user_can( 'edit_users' ) && ! bbp_is_user_home_edit() ) : ?>
    144144
    145         <h2 class="entry-title"><?php _e( 'Capabilities', 'bbpress' ) ?></h2>
     145        <h2 class="entry-title"><?php _e( 'User Role', 'bbpress' ) ?></h2>
    146146
    147147        <fieldset class="bbp-form">
    148             <legend><?php _e( 'Forum Capabilities', 'bbpress' ); ?></legend>
    149 
    150             <div>
    151                 <label for="role"><?php _e( 'Role', 'bbpress' ) ?></label>
    152 
    153                 <?php bbp_edit_user_role(); ?>
    154 
    155             </div>
     148            <legend><?php _e( 'User Role', 'bbpress' ); ?></legend>
    156149
    157150            <?php if ( is_multisite() && is_super_admin() && current_user_can( 'manage_network_options' ) ) : ?>
     
    168161
    169162            <div>
    170 
    171                 <?php foreach ( bbp_get_capability_groups() as $group ) : ?>
    172 
    173                     <dl class="bbp-user-capabilities">
    174                         <dt><?php bbp_capability_group_title( $group ); ?></dt>
    175 
    176                         <?php foreach ( bbp_get_capabilities_for_group( $group ) as $capability ) : ?>
    177 
    178                             <dd>
    179                                 <label for="_bbp_<?php echo $capability; ?>">
    180                                     <input class="checkbox" type="checkbox" id="_bbp_<?php echo $capability; ?>" name="_bbp_<?php echo $capability; ?>" value="1" <?php checked( user_can( bbp_get_displayed_user_id(), $capability ) ); ?> tabindex="<?php bbp_tab_index(); ?>" />
    181                                     <?php bbp_capability_title( $capability ); ?>
    182                                 </label>
    183                             </dd>
    184 
    185                         <?php endforeach; ?>
    186 
    187                     </dl>
    188 
    189                 <?php endforeach; ?>
    190 
     163                <label for="role"><?php _e( 'Role', 'bbpress' ) ?></label>
     164
     165                <?php bbp_edit_user_role(); ?>
     166
     167            </div>
     168
     169            <div>
     170                <label for=""><?php _e( 'Forum Capabilities', 'bbpress' ); ?></label>
     171
     172                <fieldset class="bbp-form capabilities">
     173                    <legend><?php _e( 'Forum Capabilities', 'bbpress' ); ?></legend>
     174
     175                    <?php foreach ( bbp_get_capability_groups() as $group ) : ?>
     176
     177                        <dl class="bbp-user-capabilities">
     178                            <dt><?php bbp_capability_group_title( $group ); ?></dt>
     179
     180                            <?php foreach ( bbp_get_capabilities_for_group( $group ) as $capability ) : ?>
     181
     182                                <dd>
     183                                    <label for="_bbp_<?php echo $capability; ?>">
     184                                        <input class="checkbox" type="checkbox" id="_bbp_<?php echo $capability; ?>" name="_bbp_<?php echo $capability; ?>" value="1" <?php checked( user_can( bbp_get_displayed_user_id(), $capability ) ); ?> tabindex="<?php bbp_tab_index(); ?>" />
     185                                        <?php bbp_capability_title( $capability ); ?>
     186                                    </label>
     187                                </dd>
     188
     189                            <?php endforeach; ?>
     190
     191                        </dl>
     192
     193                    <?php endforeach; ?>
     194                </fieldset>
     195            </div>
     196           
     197            <div>
     198                <label for="bbp-default-caps"><?php _e( 'Reset', 'bbpress' ); ?></label>
     199                <label>
     200                    <input class="checkbox" type="checkbox" id="bbp-default-caps" name="bbp-default-caps" tabindex="<?php bbp_tab_index(); ?>" />
     201                    <?php _e( 'Reset forum capabilities to match the user role.', 'bbpress' ); ?>
     202                </label>
    191203            </div>
    192204
  • trunk/bbp-theme-compat/css/bbpress.css

    r4197 r4222  
    589589    #bbpress-forums #bbp-your-profile fieldset fieldset {
    590590        margin: 0;
    591         width: 260px;
    592591        border: none;
    593592        padding: 0;
     
    595594        float: none;
    596595    }
    597     #bbp-your-profile fieldset fieldset span.description {
     596    #bbpress-forums #bbp-your-profile fieldset fieldset.password {
     597        width: 260px;
     598    }
     599    #bbpress-forums #bbp-your-profile fieldset fieldset.capabilities dl {
     600        margin: 0;
     601    }
     602    #bbp-your-profile fieldset fieldset.password span.description {
    598603        margin-left: 0;
    599604        margin-bottom: 20px;
  • trunk/bbp-themes/bbp-twentyten/bbpress/form-user-edit.php

    r4034 r4222  
    125125        <div id="password">
    126126            <label for="pass1"><?php _e( 'New Password', 'bbpress' ); ?></label>
    127             <fieldset class="bbp-form">
     127            <fieldset class="bbp-form password">
    128128                <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" tabindex="<?php bbp_tab_index(); ?>" />
    129129                <span class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.', 'bbpress' ); ?></span>
     
    139139        <?php if ( current_user_can( 'edit_users' ) && ! bbp_is_user_home_edit() ) : ?>
    140140
    141             <div>
    142                 <label for="role"><?php _e( 'Role:', 'bbpress' ) ?></label>
    143 
    144                 <?php bbp_edit_user_role(); ?>
    145 
    146             </div>
    147 
    148         <?php endif; ?>
    149 
    150         <?php if ( is_multisite() && is_super_admin() && current_user_can( 'manage_network_options' ) ) : ?>
    151 
    152             <div>
    153                 <label for="role"><?php _e( 'Super Admin', 'bbpress' ); ?></label>
    154                 <label>
    155                     <input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( bbp_get_displayed_user_id() ) ); ?> tabindex="<?php bbp_tab_index(); ?>" />
    156                     <?php _e( 'Grant this user super admin privileges for the Network.', 'bbpress' ); ?>
    157                 </label>
    158             </div>
     141            <h2 class="entry-title"><?php _e( 'User Role', 'bbpress' ) ?></h2>
     142
     143            <fieldset class="bbp-form">
     144                <legend><?php _e( 'User Role', 'bbpress' ); ?></legend>
     145
     146                <?php if ( is_multisite() && is_super_admin() && current_user_can( 'manage_network_options' ) ) : ?>
     147
     148                    <div>
     149                        <label for="super_admin"><?php _e( 'Super Admin', 'bbpress' ); ?></label>
     150                        <label>
     151                            <input class="checkbox" type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( bbp_get_displayed_user_id() ) ); ?> tabindex="<?php bbp_tab_index(); ?>" />
     152                            <?php _e( 'Grant this user super admin privileges for the Network.', 'bbpress' ); ?>
     153                        </label>
     154                    </div>
     155
     156                <?php endif; ?>
     157
     158                <div>
     159                    <label for="role"><?php _e( 'Role', 'bbpress' ) ?></label>
     160
     161                    <?php bbp_edit_user_role(); ?>
     162
     163                </div>
     164
     165                <div>
     166                    <label for=""><?php _e( 'Forum Capabilities', 'bbpress' ); ?></label>
     167
     168                    <fieldset class="bbp-form capabilities">
     169                        <legend><?php _e( 'Forum Capabilities', 'bbpress' ); ?></legend>
     170
     171                        <?php foreach ( bbp_get_capability_groups() as $group ) : ?>
     172
     173                            <dl class="bbp-user-capabilities">
     174                                <dt><?php bbp_capability_group_title( $group ); ?></dt>
     175
     176                                <?php foreach ( bbp_get_capabilities_for_group( $group ) as $capability ) : ?>
     177
     178                                    <dd>
     179                                        <label for="_bbp_<?php echo $capability; ?>">
     180                                            <input class="checkbox" type="checkbox" id="_bbp_<?php echo $capability; ?>" name="_bbp_<?php echo $capability; ?>" value="1" <?php checked( user_can( bbp_get_displayed_user_id(), $capability ) ); ?> tabindex="<?php bbp_tab_index(); ?>" />
     181                                            <?php bbp_capability_title( $capability ); ?>
     182                                        </label>
     183                                    </dd>
     184
     185                                <?php endforeach; ?>
     186
     187                            </dl>
     188
     189                        <?php endforeach; ?>
     190                    </fieldset>
     191                </div>
     192
     193                <div>
     194                    <label for="bbp-default-caps"><?php _e( 'Reset Forum Capabilities', 'bbpress' ); ?></label>
     195                    <label>
     196                        <input class="checkbox" type="checkbox" id="bbp-default-caps" name="bbp-default-caps" tabindex="<?php bbp_tab_index(); ?>" />
     197                        <?php _e( 'Reset forum capabilities to match the user role.', 'bbpress' ); ?>
     198                    </label>
     199                </div>
     200
     201            </fieldset>
    159202
    160203        <?php endif; ?>
  • trunk/bbp-themes/bbp-twentyten/css/bbpress.css

    r3987 r4222  
    556556    #container #bbp-your-profile fieldset fieldset {
    557557        margin: 0;
    558         width: 260px;
    559558        border: none;
    560559        padding: 0;
    561560        clear: none;
    562561        float: none;
     562    }
     563    #bbp-your-profile fieldset fieldset.password {
     564        width: 260px;
     565    }
     566    #bbp-your-profile fieldset fieldset.capabilities dl {
     567        margin: 0;
    563568    }
    564569    #bbp-your-profile fieldset fieldset span.description {
  • trunk/bbpress.php

    r4215 r4222  
    209209        $this->hidden_status_id  = apply_filters( 'bbp_hidden_post_status',  'hidden'  );
    210210        $this->trash_status_id   = apply_filters( 'bbp_trash_post_status',   'trash'   );
    211         $this->bozo_status_id    = apply_filters( 'bbp_bozo_post_status',    'bozo'    );
    212211
    213212        // Other identifiers
     
    710709        );
    711710
    712         // Bozo
    713         register_post_status(
    714             bbp_get_bozo_status_id(),
    715             apply_filters( 'bbp_register_bozo_post_status', array(
    716                 'label'                     => _x( 'Bozo', 'post', 'bbpress' ),
    717                 'label_count'               => _nx_noop( 'Bozo <span class="count">(%s)</span>', 'Bozo <span class="count">(%s)</span>', 'bbpress' ),
    718                 'private'                   => true,
    719                 'exclude_from_search'       => true,
    720                 'show_in_admin_status_list' => true,
    721                 'show_in_admin_all_list'    => false
    722             ) )
    723         );
    724 
    725711        /**
    726712         * Trash fix
     
    829815
    830816    /**
     817     * Register the bbPress capabilities
     818     *
     819     * @since bbPress (r3031)
     820     *
     821     * @uses BBP_Capabilities
     822     */
     823    public function register_capabilities() {
     824        $this->capabilities = new BBP_Capabilities();
     825    }
     826
     827    /**
    831828     * Setup the currently logged-in user
    832829     *
Note: See TracChangeset for help on using the changeset viewer.