Fix wp.getusersblogs error in Windows Live Writer after upgrading to WordPress MU 1.5.1

I have been using Microsoft Windows Live Writer to update my blogs for a while, but today I got some errors when I tried to publish a post to my newly upgraded WordPress MU 1.5.1 blog. After this error message, I got a prompt windows to ask my blog logon user name and password. I thought the upgrading changed the user information anyhow, so that I updated my logon password, and re-typed it in Live Writer. When I re-published, again saw the same error. I stopped, and then tried to view the web blog within the WLW. The same wp.getusersblogs error popped-up as I encountered during the publishing.

The following is the detailed error message:

log Server Error – Server Error -32601 Occurred server error. requested method wp.getUsersBlogs does not exist. You must correct this error before proceeding.


After I searched on the WordPress MU supporting forum, I was re-directed to a trac-ticket (http://trac.mu.wordpress.org/ticket/631) site. Then I realized the cause was the file named xmlrpc.php in MU 1.5.1 version.

To resolve this problem, open the xmlrpc.php file in your favorite web code editor, and look for the following code.

Line 94 ‘blogger.getUsersBlogs’ => ‘this:blogger_getUsersBlogs’,

You can add one line code right before it as the following:

‘wp.getUsersBlogs’=> ‘this:wp_getUsersBlogs’,

Next, go to the line 221 “* WordPress XML-RPC API”, create a new function called wp_getUserBlogs and insert before the function of wp_getPage. You can copy and paste the following lines of codes:

              * wp_getUsersBlogs 
              */ 
                 function wp_getUsersBlogs($args) { 
                         $this->escape($args); 
                         $username = $args[0]; 
                         $password = $args[1]; 
                         if (!$this->login_pass_ok($username, $password) ) 
                                 return $this->error; 
                         do_action(’xmlrpc_call’, ‘wp.getUsersBlogs’); 
                         $user = set_current_user(0, $username); 
                         $blogs = (array) get_blogs_of_user($user->ID); 
                         $struct = array(); 
                         foreach ( $blogs as $blog ) { 
              // Don’t include blogs that aren’t hosted at wordpress.com 
                                 if ( $blog->site_id != 1 ) 
                                         continue; 
                                 $blog_id = $blog->userblog_id; 
                                 switch_to_blog($blog_id); 
                                 $is_admin = current_user_can(’level_8′); 
                                 $struct[] = array( 
                                         ‘isAdmin’  => $is_admin, 
                                         ‘url’         => get_option(’home’) . ‘/’, 
                                         ‘blogid’    => $blog_id, 
                                       ‘blogName’  => get_option(’blogname’), 
                                   ‘xmlrpc’   =>get_option(’home’). ‘/xmlrpc.php’ 
                                 ); 
                         } 
                         return $struct; 
                 } 

The new function above is the similar the function of blogger_getUsersBlogs you can find from the line 753 to line 791.

After these two changes, save your modified file of xmlrpc.php and upload it to your server. Now you should be fine with your MU 1.5.1 by using Windows Live Writer again.

If you are lazy as I am, you can download the modified xmlrpc.php from here.

  • Share/Bookmark
Tags: , , ,

Related posts

1 Responses to “Fix wp.getusersblogs error in Windows Live Writer after upgrading to WordPress MU 1.5.1”


Leave a Reply