Introduce WP_User::for_blog() and current_user_can_for_blog() to avoid calls to WP_User::_init_caps(). fixes #11781
git-svn-id: http://svn.automattic.com/wordpress/trunk@12796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -222,6 +222,7 @@ switch ( $_GET['action'] ) {
|
||||
|
||||
// get blog prefix
|
||||
$blog_prefix = $wpdb->get_blog_prefix( $id );
|
||||
|
||||
// user roles
|
||||
if ( is_array( $_POST[ 'role' ] ) == true ) {
|
||||
$newroles = $_POST[ 'role' ];
|
||||
@@ -230,8 +231,7 @@ switch ( $_GET['action'] ) {
|
||||
$user = new WP_User($userid);
|
||||
if ( ! $user )
|
||||
continue;
|
||||
// Hack. Init user caps for given blog.
|
||||
$user->_init_caps($blog_prefix . 'capabilities');
|
||||
$user->for_blog($id);
|
||||
$user->set_role($role);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user