mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 14:50:29 +00:00
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:
@@ -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