Changeset 8075
- Timestamp:
- 06/12/2008 09:41:18 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r7991 r8075 111 111 $this->methods = array( 112 112 // WordPress API 113 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs', 113 114 'wp.getPage' => 'this:wp_getPage', 114 115 'wp.getPages' => 'this:wp_getPages', … … 253 254 } 254 255 } 256 } 257 258 /** 259 * WordPress XML-RPC API 260 * wp_getUsersBlogs 261 */ 262 function wp_getUsersBlogs( $args ) { 263 // If this isn't on WPMU then just use blogger_getUsersBlogs 264 if( !function_exists( 'is_site_admin' ) ) { 265 array_unshift( $args, 1 ); 266 return $this->blogger_getUsersBlogs( $args ); 267 } 268 269 $this->escape( $args ); 270 271 $username = $args[0]; 272 $password = $args[1]; 273 274 if( !$this->login_pass_ok( $username, $password ) ) 275 return $this->error; 276 277 do_action( 'xmlrpc_call', 'wp.getUsersBlogs' ); 278 279 $user = set_current_user( 0, $username ); 280 281 $blogs = (array) get_blogs_of_user( $user->ID ); 282 $struct = array( ); 283 284 foreach( $blogs as $blog ) { 285 // Don't include blogs that aren't hosted at this site 286 if( $blog->site_id != 1 ) 287 continue; 288 289 $blog_id = $blog->userblog_id; 290 switch_to_blog($blog_id); 291 $is_admin = current_user_can('level_8'); 292 293 $struct[] = array( 294 'isAdmin' => $is_admin, 295 'url' => get_option( 'home' ) . '/', 296 'blogid' => $blog_id, 297 'blogName' => get_option( 'blogname' ), 298 'xmlrpc' => get_option( 'home' ) . '/xmlrpc.php' 299 ); 300 } 301 302 return $struct; 255 303 } 256 304 … … 842 890 'url' => get_option('home') . '/', 843 891 'blogid' => '1', 844 'blogName' => get_option('blogname') 892 'blogName' => get_option('blogname'), 893 'xmlrpc' => get_option('home') . '/xmlrpc.php', 845 894 ); 846 895
Note: See TracChangeset
for help on using the changeset viewer.