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:
ryan
2010-01-22 17:27:28 +00:00
parent 6847f8ea95
commit 92bf8d124c
3 changed files with 51 additions and 4 deletions

View File

@@ -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);
}
}