Introduce WP_User::for_blog() and current_user_can_for_blog() to avoid calls to WP_User::_init_caps(). fixes #11781

git-svn-id: https://develop.svn.wordpress.org/trunk@12796 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-01-22 17:27:28 +00:00
parent ffd8c38ae1
commit 57577592b6
3 changed files with 51 additions and 4 deletions
+2 -2
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);
}
}