Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/04/2012 02:11:16 AM (14 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/admin/users.php

    r4309 r4330  
    4949                // User profile edit/display actions
    5050                add_action( 'edit_user_profile', array( $this, 'secondary_role_display' ) );
    51 
    52                 // Show advanced capabilities
    53                 if ( bbp_use_advanced_capability_editor() ) {
    54 
    55                         // Admin styles
    56                         add_action( 'admin_head',        array( $this, 'admin_head' ) );
    57 
    58                         // User profile edit/display actions
    59                         add_action( 'edit_user_profile', array( $this, 'advanced_capability_display' ) );
    60 
    61                         // Noop WordPress additional caps output area
    62                         add_filter( 'additional_capabilities_display', '__return_false' );
    63                 }
    64         }
    65 
    66         /**
    67          * Add some general styling to the admin area
    68          *
    69          * @since bbPress (r2464)
    70          *
    71          * @uses bbp_get_forum_post_type() To get the forum post type
    72          * @uses bbp_get_topic_post_type() To get the topic post type
    73          * @uses bbp_get_reply_post_type() To get the reply post type
    74          * @uses sanitize_html_class() To sanitize the classes
    75          */
    76         public function admin_head() {
    77                 ?>
    78 
    79                 <style type="text/css" media="screen">
    80                 /*<![CDATA[*/
    81                         div.bbp-user-capabilities {
    82                                 margin: 0 10px 10px;
    83                                 display: inline-block;
    84                                 vertical-align: top;
    85                         }
    86 
    87                         div.bbp-user-capabilities h4 {
    88                                 margin: 0 0 10px;
    89                         }
    90 
    91                         p.bbp-default-caps-wrapper {
    92                                 clear: both;
    93                                 margin: 80px -10px 0;
    94                         }
    95                 /*]]>*/
    96                 </style>
    97 
    98                 <?php
    9951        }
    10052
     
    150102                <?php
    151103        }
    152 
    153         /**
    154          * Responsible for displaying bbPress's advanced capability interface.
    155          *
    156          * Hidden by default. Must be explicitly enabled.
    157          *
    158          * @since bbPress (r2464)
    159          *
    160          * @param WP_User $profileuser User data
    161          * @uses do_action() Calls 'bbp_user_profile_forums'
    162          * @return bool Always false
    163          */
    164         public function advanced_capability_display( $profileuser ) {
    165 
    166                 // Bail if current user cannot edit users
    167                 if ( ! current_user_can( 'edit_user', $profileuser->ID ) )
    168                         return; ?>
    169 
    170                 <table class="form-table">
    171                         <tbody>
    172                                 <tr>
    173                                         <th><?php _e( 'This user can:', 'bbpress' ); ?></th>
    174 
    175                                         <td>
    176                                                 <fieldset>
    177                                                         <legend class="screen-reader-text"><span><?php _e( 'Additional Capabilities', 'bbpress' ); ?></span></legend>
    178 
    179                                                         <?php foreach ( bbp_get_capability_groups() as $group ) : ?>
    180 
    181                                                                 <div class="bbp-user-capabilities">
    182                                                                         <h4><?php bbp_capability_group_title( $group ); ?></h4>
    183 
    184                                                                         <?php foreach ( bbp_get_capabilities_for_group( $group ) as $capability ) : ?>
    185 
    186                                                                                 <label for="_bbp_<?php echo $capability; ?>">
    187                                                                                         <input id="_bbp_<?php echo $capability; ?>" name="_bbp_<?php echo $capability; ?>" type="checkbox" id="_bbp_<?php echo $capability; ?>" value="1" <?php checked( user_can( $profileuser->ID, $capability ) ); ?> />
    188                                                                                         <?php bbp_capability_title( $capability ); ?>
    189                                                                                 </label>
    190                                                                                 <br />
    191 
    192                                                                         <?php endforeach; ?>
    193 
    194                                                                 </div>
    195 
    196                                                         <?php endforeach; ?>
    197 
    198                                                         <p class="bbp-default-caps-wrapper">
    199                                                                 <input type="submit" name="bbp-default-caps" class="button" value="<?php esc_attr_e( 'Reset to Default', 'bbpress' ); ?>"/>
    200                                                         </p>
    201 
    202                                                 </fieldset>
    203                                         </td>
    204                                 </tr>
    205 
    206                         </tbody>
    207                 </table>
    208 
    209                 <?php
    210         }
    211104}
    212105new BBP_Users_Admin();
Note: See TracChangeset for help on using the changeset viewer.