Changeset 4308
- Timestamp:
- 11/02/2012 07:58:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/users/capabilities.php
r4249 r4308 19 19 function bbp_get_primary_capabilities() { 20 20 return apply_filters( 'bbp_get_primary_capabilities', array( 21 22 // Current caps 23 'spectate', 21 24 'participate', 22 25 'moderate', 23 26 'throttle', 24 'view_trash' 27 'view_trash', 28 29 // Legacy caps 30 'banned', 31 'blocked', 32 'bozo' 25 33 ) ); 26 34 } … … 43 51 switch ( $cap ) { 44 52 45 /** 46 * The 'participate' capability is similar to WordPress's 'read' cap, 47 * in that it is the minimum required cap to perform any other bbPress 48 * related thing. 49 */ 53 // Minimum required cap to read any forum content 54 case 'spectate' : 55 56 // Minimum required cap to create any forum content 50 57 case 'participate' : 51 58 … … 64 71 65 72 break; 66 73 67 74 case 'moderate' : 68 75 … … 136 143 137 144 // Add caps for the first role 138 foreach ( $caps as $cap )139 $user->add_cap( $cap, true );145 foreach ( $caps as $cap => $value ) 146 $user->add_cap( $cap, $value ); 140 147 141 148 // Success … … 193 200 * @usse bbp_save_user_caps() to save caps 194 201 */ 195 function bbp_ edit_user_profile_update_capabilities( $user_id = 0 ) {202 function bbp_profile_update_capabilities( $user_id = 0 ) { 196 203 197 204 // Bail if no user ID was passed … … 199 206 return; 200 207 201 // Either reset caps for role 202 if ( ! empty( $_POST['bbp-default-caps'] ) ) { 203 bbp_reset_user_caps( $user_id ); 204 205 // Or set caps individually 206 } else { 207 bbp_save_user_caps( $user_id ); 208 // Bail if advanced capability editor is off 209 if ( ! empty( $_POST['bbp-forums-role'] ) ) { 210 211 // Fromus role we want the user to have 212 $new_role = stripslashes( $_POST['bbp-forums-role'] ); 213 $forums_role = bbp_get_user_role( $user_id ); 214 215 // Set the new forums role 216 if ( $new_role != $forums_role ) { 217 bbp_set_user_role( $user_id, $new_role ); 218 } 219 220 // Remove any interim form user capabilities 221 bbp_remove_user_caps( $user_id ); 222 } 223 224 // Save additional capabilities 225 if ( bbp_use_advanced_capability_editor() ) { 226 227 // Either reset caps for role 228 if ( ! empty( $_POST['bbp-default-caps'] ) ) { 229 bbp_reset_user_caps( $user_id ); 230 231 // Or set caps individually 232 } else { 233 bbp_save_user_caps( $user_id ); 234 } 208 235 } 209 236 } … … 240 267 241 268 // Assign the default role to the current user 242 bbpress()->current_user-> set_role( get_option( 'default_role', 'subscriber') );243 } 269 bbpress()->current_user->add_role( bbp_get_default_role() ); 270 }
Note: See TracChangeset
for help on using the changeset viewer.