Changeset 4301
- Timestamp:
- 11/02/2012 07:25:11 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/users.php
r4279 r4301 47 47 return; 48 48 49 // Admin styles50 add_action( 'admin_head', array( $this, 'admin_head' ) );51 52 49 // User profile edit/display actions 53 add_action( 'edit_user_profile', array( $this, 'user_profile_forums' ) ); 54 55 // Noop WordPress additional caps output area 56 add_filter( 'additional_capabilities_display', '__return_false' ); 50 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 } 57 64 } 58 65 … … 93 100 94 101 /** 95 * Responsible for saving additional profile options and settings 102 * Default interface for setting a forum role 103 * 104 * @since bbPress (r4285) 105 * 106 * @param WP_User $profileuser User data 107 * @return bool Always false 108 */ 109 public function secondary_role_display( $profileuser ) { 110 111 // Bail if current user cannot edit users 112 if ( ! current_user_can( 'edit_user', $profileuser->ID ) ) 113 return; ?> 114 115 <h3><?php _e( 'Forums', 'bbpress' ); ?></h3> 116 117 <table class="form-table"> 118 <tbody> 119 <tr> 120 <th><?php _e( 'Forum Role', 'bbpress' ); ?></th> 121 <td> 122 123 <?php $user_role = bbp_get_user_role( $profileuser->ID ); ?> 124 125 <select name="bbp-forums-role" id="bbp-forums-role"> 126 127 <?php if ( ! empty( $user_role ) ) : ?> 128 129 <option value=""><?php _e( '— No role for this forum —', 'bbpress' ); ?></option> 130 131 <?php else : ?> 132 133 <option value="" selected="selected"><?php _e( '— No role for this forum —', 'bbpress' ); ?></option> 134 135 <?php endif; ?> 136 137 <?php foreach ( bbp_get_editable_roles() as $role => $details ) : ?> 138 139 <option <?php selected( $user_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo translate_user_role( $details['name'] ); ?></option> 140 141 <?php endforeach; ?> 142 143 </select> 144 </td> 145 </tr> 146 147 </tbody> 148 </table> 149 150 <?php 151 } 152 153 /** 154 * Responsible for displaying bbPress's advanced capability interface. 155 * 156 * Hidden by default. Must be explicitly enabled. 96 157 * 97 158 * @since bbPress (r2464) … … 101 162 * @return bool Always false 102 163 */ 103 public function user_profile_forums( $profileuser ) {164 public function advanced_capability_display( $profileuser ) { 104 165 105 166 // Bail if current user cannot edit users 106 167 if ( ! current_user_can( 'edit_user', $profileuser->ID ) ) 107 168 return; ?> 108 109 <h3><?php _e( 'Forum Capabilities', 'bbpress' ); ?></h3>110 169 111 170 <table class="form-table">
Note: See TracChangeset
for help on using the changeset viewer.