Skip to content

Commit

Permalink
Don't use switch_to_blog() in wp.getUsersBlogs to improve performance…
Browse files Browse the repository at this point in the history
… and memory footprint. props mohanjith for initial patch. fixes #20665.

git-svn-id: http://core.svn.wordpress.org/trunk@21194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Jun 30, 2012
1 parent 4664d4b commit 81c22c9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions wp-includes/class-wp-xmlrpc-server.php
Expand Up @@ -473,18 +473,15 @@ function wp_getUsersBlogs( $args ) {
continue;

$blog_id = $blog->userblog_id;
switch_to_blog($blog_id);
$is_admin = current_user_can('manage_options');
$is_admin = current_user_can_for_blog( $blog_id, 'manage_options' );

$struct[] = array(
'isAdmin' => $is_admin,
'url' => get_option( 'home' ) . '/',
'url' => get_home_url( $blog_id, '/' ),
'blogid' => (string) $blog_id,
'blogName' => get_option( 'blogname' ),
'xmlrpc' => site_url( 'xmlrpc.php' )
'blogName' => get_blog_option( $blog_id, 'blogname' ),
'xmlrpc' => get_site_url( $blog_id, 'xmlrpc.php' )
);

restore_current_blog();
}

return $struct;
Expand Down

0 comments on commit 81c22c9

Please sign in to comment.