Ticket #307 (assigned defect)

Opened 1 year ago

Last modified 10 months ago

xmlrpc problem when blogger.getUsersBlogs

Reported by: miyauchi Assigned to: donncha (accepted)
Priority: high Milestone: WPMU 2.0
Component: component1 Version: 2.0
Severity: major Keywords: has-patch
Cc: drmike

Description

when blogger.getUsersBlogs, response XML is netsted like

<array><data><value><array><data><value>

Therefore, it don't work.

I modify it as follows.
xmlrpc.php line 581 to 596

$req_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
foreach ( $blogs as $blog ) {
	$rpc_url = get_option('home') . '/xmlrpc.php';
	if( $rpc_url == $req_url ){
		$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')
		);
		break;
	}
}
if($struct){
	return array($struct);
}else{
	return $this->error;
}

It works without trouble in SSL off.
thanks.

Change History

04/14/07 22:55:07 changed by drmike

  • severity changed from normal to major.
  • cc set to drmike.
  • priority changed from normal to high.
  • version changed from 1.0 to 2.0.
  • milestone changed from WPMU 1.0 to WPMU 2.0.
  • keywords set to has-patch.

Bumped up as it appears to completly mucks up xmlrpc.

04/17/07 16:21:59 changed by donncha

  • owner changed from somebody to donncha.
  • status changed from new to assigned.

This looks like it stops after the first blog, what if the user has more than one blog?

04/17/07 18:00:00 changed by drmike

Shouldn't as there's an array call right before it on line #577.

04/18/07 06:20:16 changed by miyauchi

I think...

if the user has more blog that blog have another xmlrpc url.

In my conception the set of the user, the password, and URL matches only to one blog.

thanks

04/18/07 16:13:28 changed by donncha

the weird thing about this is it works fine on wordpress.com, but not in wpmu even though both are the using the same code and both return the same data.

The patch above is wrong however. It will only return the current blog, not all blogs owned by the user. I was wrong in saying, "the first blog" above. The function has to return all blogs. Try it on wordpress.com if you have a couple of blogs there.

04/18/07 16:27:25 changed by drmike

Just checked with my own WPMu install using Blogdesk and it did return only a single blog id.

04/18/07 17:44:55 changed by miyauchi

The function has to return all blogs.

I understand and that is wonderful.

But I hope to solve the following trouble.
I do not stick to my patch.

response XML at wordpress.com

<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <array><data>
  <value><struct>...

response XML at wpmu 1.2.1

<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <array><data>
  <value><array><data>
  <value><struct>...

(follow-up: ↓ 9 ) 04/20/07 13:39:10 changed by drmike

My client says she's only able to pull up her first blog. She isn't able to get the full list.

(in reply to: ↑ 8 ) 04/20/07 13:39:35 changed by drmike

Replying to drmike:

My client says she's only able to pull up her first blog. She isn't able to get the full list.

That's with the patch up above. Without it, no list is obtainable.

04/20/07 20:49:31 changed by miyauchi

Thank you for trying, drmike.

wordpress.com returned full list.
But wpmu returned no list.
Because response XML is ??? at wpmu.

04/23/07 11:05:19 changed by conoro

I can confirm that WPMU 1.2.1 is not working with Windows Live Writer and it looks like it is due to the bug described above.

When you try to point WLW at a WPMU blog, the error from WLW is "The server reported that you do not have an active weblog". I think this is a regression from WPMU 1.1.1

05/07/07 18:53:22 changed by drmike

Found the following in my logs:

[06-May-2007 23:10:22] PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/dariabe/public_html/xmlrpc.php on line 1911

Do note that my line numbers are going to be off as I'm using that fix up above.

And I can't count lines today as I'm on my locked down terminal. :(

05/11/07 01:42:06 changed by drmike

Ignore my error report up above. I had the fix in there incorrectly.

Without the fix, I'm getting a "Error getting Blog.ID - Bad ResponseValueType?" error in Blogdesk. Can't find anything simular to that error on the net

With the fix in there, it thinks every blog is number 130 and I don't have that blogid in my list.

Do note though that if you give the blogid manually to blogdesk, all works fine.

05/11/07 01:43:22 changed by drmike

Oh yeah. And if you take the xmlrpc.php file out of the regular wp trac, every blog is id 1. :)

05/12/07 20:02:07 changed by drmike

It appears that if you use the current xmlrpc.php file in trac and use the actual URL of the blog in question instead of the general URL of the site, everything works fine.

I'm able to pull a list of blogs via ecto but not able to interact with them all. Says it's an array where blogid is.

Blogdesk still reports that everything is blog 130 which is the first blog in our setup that is in our domain mapping program and has a different siteid. That may be the issue as well.

05/30/07 09:17:31 changed by kingler

Simple fix that worked for me (removed the extra nested array):

in the last line of function blogger_getUsersBlogs($args)

simply use

return $struct;

instead of

return array($struct);

05/30/07 09:53:04 changed by donncha

Thanks kingler, I tried that and it seems to work. I checked it in [991] if anyone else wants to try it.

05/31/07 15:17:23 changed by drmike

My users are still reporting issues:

Link

So here is what is happening now. I can pull up a title for all three of my blogs in Ecto, however all three are listing the same posts. When I change to a different xmlrc (started with resonance and then theoryu), it still pulls up all three of the blogs, shows only posts from resonance. So I have three blog titles but all the blogs have the same resonance postings.

Update, I went in and refreshed ecto and now it is giving all of the posts for the two blogs but they are all mixed up - theoryu in with resonance.

06/11/07 11:24:19 changed by donncha

I saw the same issue with multiple blogs too :(

06/12/07 00:10:41 changed by drmike

*chuckle* Maybe we can use this excuce to get wp.com's multiple domain hosting code. :)

09/14/07 14:05:16 changed by drmiketemp

Had a thought on this yesterday on my walk in.

What if we were to limit the blog list for that user to only the blogs within the $site that is being accessed?