diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
index 375648e768..ba722f8f06 100644
|
a
|
b
|
function current_user_can_for_blog( $blog_id, $capability ) { |
| 659 | 659 | return $can; |
| 660 | 660 | } |
| 661 | 661 | |
| | 662 | /** |
| | 663 | * Whether a particular user has a specific capability for a given site. |
| | 664 | * |
| | 665 | * |
| | 666 | * @param int|WP_User $user User ID or object. |
| | 667 | * @param string $capability Capability name. |
| | 668 | * @return bool Whether the user has the given capability. |
| | 669 | */ |
| | 670 | function user_can_for_blog( $user, $blog_id, $capability ) { |
| | 671 | if ( ! is_object( $user ) ) { |
| | 672 | $user = get_userdata( $user ); |
| | 673 | } |
| | 674 | |
| | 675 | if ( ! $user || ! $user->exists() ) { |
| | 676 | return false; |
| | 677 | } |
| | 678 | |
| | 679 | $switched = is_multisite() ? switch_to_blog( $blog_id ) : false; |
| | 680 | |
| | 681 | $args = array_slice( func_get_args(), 2 ); |
| | 682 | $args = array_merge( array( $capability ), $args ); |
| | 683 | |
| | 684 | $can = call_user_func_array( array( $user, 'has_cap' ), $args ); |
| | 685 | |
| | 686 | if ( $switched ) { |
| | 687 | restore_current_blog(); |
| | 688 | } |
| | 689 | |
| | 690 | return $can; |
| | 691 | } |
| | 692 | |
| 662 | 693 | /** |
| 663 | 694 | * Whether the author of the supplied post has a specific capability. |
| 664 | 695 | * |