Changeset 32173 for trunk/src/wp-includes/capabilities.php
- Timestamp:
- 04/20/2015 07:26:05 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/capabilities.php
r31673 r32173 1404 1404 */ 1405 1405 function current_user_can_for_blog( $blog_id, $capability ) { 1406 if ( is_multisite() ) 1407 switch_to_blog( $blog_id ); 1406 $switched = is_multisite() ? switch_to_blog( $blog_id ) : false; 1408 1407 1409 1408 $current_user = wp_get_current_user(); 1410 1409 1411 if ( empty( $current_user ) ) 1410 if ( empty( $current_user ) ) { 1411 if ( $switched ) { 1412 restore_current_blog(); 1413 } 1412 1414 return false; 1415 } 1413 1416 1414 1417 $args = array_slice( func_get_args(), 2 ); … … 1417 1420 $can = call_user_func_array( array( $current_user, 'has_cap' ), $args ); 1418 1421 1419 if ( is_multisite() )1422 if ( $switched ) { 1420 1423 restore_current_blog(); 1424 } 1421 1425 1422 1426 return $can;
Note: See TracChangeset
for help on using the changeset viewer.