Changeset 9945 for trunk/src/bp-core/bp-core-caps.php
- Timestamp:
- 06/15/2015 08:48:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-caps.php
r9819 r9945 66 66 67 67 // Load roles if not set 68 if ( ! isset( $wp_roles ) ) 68 if ( ! isset( $wp_roles ) ) { 69 69 $wp_roles = new WP_Roles(); 70 } 70 71 71 72 // Loop through available roles and add them … … 101 102 102 103 // Load roles if not set 103 if ( ! isset( $wp_roles ) ) 104 if ( ! isset( $wp_roles ) ) { 104 105 $wp_roles = new WP_Roles(); 106 } 105 107 106 108 // Loop through available roles and remove them … … 200 202 break; 201 203 202 case 'editor' : 203 case 'author' : 204 case 'contributor' : 205 case 'subscriber' : 206 default : 204 // All other default WordPress blog roles 205 case 'editor' : 206 case 'author' : 207 case 'contributor' : 208 case 'subscriber' : 209 default : 207 210 $caps = array(); 208 211 break; … … 240 243 241 244 // Bail if not multisite or not root blog 242 if ( ! is_multisite() || ! bp_is_root_blog() ) 245 if ( ! is_multisite() || ! bp_is_root_blog() ) { 243 246 return; 247 } 244 248 245 249 // Bail if user is not logged in or already a member 246 if ( ! is_user_logged_in() || is_user_member_of_blog() ) 250 if ( ! is_user_logged_in() || is_user_member_of_blog() ) { 247 251 return; 252 } 248 253 249 254 // Bail if user is not active 250 if ( bp_is_user_inactive() ) 255 if ( bp_is_user_inactive() ) { 251 256 return; 257 } 252 258 253 259 // Set the current users default role … … 269 275 270 276 // Use root blog if no ID passed 271 if ( empty( $blog_id ) ) 277 if ( empty( $blog_id ) ) { 272 278 $blog_id = bp_get_root_blog_id(); 279 } 273 280 274 281 $retval = current_user_can_for_blog( $blog_id, $capability ); … … 300 307 * 301 308 * This implementation of 'bp_moderate' is temporary, until BuddyPress properly 302 * matches caps to roles and stores them in the database. Plugin authors: Do 303 * not use this function. 309 * matches caps to roles and stores them in the database. 310 * 311 * Plugin authors: Please do not use this function; thank you. :) 304 312 * 305 313 * @access private … … 316 324 317 325 // Bail if not checking the 'bp_moderate' cap 318 if ( 'bp_moderate' !== $cap ) 326 if ( 'bp_moderate' !== $cap ) { 319 327 return $caps; 328 } 320 329 321 330 // Bail if BuddyPress is not network activated 322 if ( bp_is_network_activated() ) 331 if ( bp_is_network_activated() ) { 323 332 return $caps; 333 } 324 334 325 335 // Never trust inactive users 326 if ( bp_is_user_inactive( $user_id ) ) 336 if ( bp_is_user_inactive( $user_id ) ) { 327 337 return $caps; 338 } 328 339 329 340 // Only users that can 'manage_options' on this site can 'bp_moderate'
Note: See TracChangeset
for help on using the changeset viewer.