Changeset 876
- Timestamp:
- 02/01/07 08:59:00 (2 years ago)
- Files:
-
- trunk/wp-includes/user.php (modified) (1 diff)
- trunk/wp-includes/wpmu-functions.php (modified) (1 diff)
- trunk/xmlrpc.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/user.php
r819 r876 49 49 $option_name = $wpdb->prefix . $option_name; 50 50 return update_usermeta( $user_id, $option_name, $newvalue ); 51 } 52 53 // Get users with capabilities for the current blog. 54 // For setups that use the multi-blog feature. 55 function get_users_of_blog( $id = '' ) { 56 global $wpdb, $wpmuBaseTablePrefix; 57 if ( empty($id) ) 58 $id = $wpdb->blogid; 59 $users = $wpdb->get_results( "SELECT user_id, user_login, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND meta_key = '" . $wpmuBaseTablePrefix . $id . "_capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); 60 return $users; 51 61 } 52 62 trunk/wp-includes/wpmu-functions.php
r866 r876 410 410 } 411 411 412 function get_users_of_blog( $id = '' ) {413 global $wpdb, $wpmuBaseTablePrefix;414 if ( empty($id) )415 $id = $wpdb->blogid;416 $users = $wpdb->get_results( "SELECT user_id, user_login, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND meta_key = '" . $wpmuBaseTablePrefix . $id . "_capabilities' ORDER BY {$wpdb->usermeta}.user_id" );417 return $users;418 }419 420 412 function get_blogs_of_user( $id, $all = false ) { 421 413 global $wpdb, $wpmuBaseTablePrefix; trunk/xmlrpc.php
r873 r876 224 224 "wp_slug" => $page->post_name, 225 225 "wp_password" => $page->post_password, 226 "wp_author" => $author-> user_nicename,226 "wp_author" => $author->display_name, 227 227 "wp_page_parent_id" => $page->post_parent, 228 228 "wp_page_parent_title" => $parent_title, … … 446 446 } 447 447 448 // Get basic info on all users. 449 $all_users = $wpdb->get_results(" 450 SELECT u.ID id, 451 u.user_login username 452 FROM {$wpdb->users} u 453 ORDER BY u.user_login 454 "); 455 456 return($all_users); 448 return(get_users_of_blog()); 457 449 } 458 450 … … 563 555 $this->escape($args); 564 556 565 $user_login = $args[1]; 566 $user_pass = $args[2]; 567 568 if (!$this->login_pass_ok($user_login, $user_pass)) 569 return $this->error; 570 571 $user = set_current_user(0, $user_login); 572 573 $blogs = (array) get_blogs_of_user($user->ID); 574 575 $struct = array(); 576 577 foreach ( $blogs as $blog ) { 578 $blog_id = $blog->userblog_id; 579 580 switch_to_blog($blog_id); 581 582 $is_admin = current_user_can('level_8'); 583 584 $struct[] = array( 585 'isAdmin' => $is_admin, 586 'url' => get_settings('home') . '/', 587 'blogid' => $blog_id, 588 'blogName' => get_settings('blogname') 589 ); 590 } 591 592 return $struct; 557 $user_login = $args[1]; 558 $user_pass = $args[2]; 559 560 if (!$this->login_pass_ok($user_login, $user_pass)) { 561 return $this->error; 562 } 563 564 set_current_user(0, $user_login); 565 $is_admin = current_user_can('level_8'); 566 567 $struct = array( 568 'isAdmin' => $is_admin, 569 'url' => get_option('home') . '/', 570 'blogid' => '1', 571 'blogName' => get_option('blogname') 572 ); 573 574 return array($struct); 593 575 } 594 576 … … 963 945 964 946 $post_author = $user->ID; 947 948 // If an author id was provided then use it instead. 949 if(!empty($content_struct["wp_author_id"])) { 950 $post_author = $content_struct["wp_author_id"]; 951 } 965 952 966 953 $post_title = $content_struct['title']; … … 1092 1079 1093 1080 // Only set the post_author if one is set. 1094 if(!empty($content_struct["wp_author"])) { 1095 $post_author = $content_struct["wp_author"]; 1081 if(!empty($content_struct["wp_author_id"])) { 1082 $post_author = $content_struct["wp_author_id"]; 1083 } 1084 1085 // Only set ping_status if it was provided. 1086 if(isset($content_struct["mt_allow_pings"])) { 1087 switch($content_struct["mt_allow_pings"]) { 1088 case "0": 1089 $ping_status = "closed"; 1090 break; 1091 case "1": 1092 $ping_status = "open"; 1093 break; 1094 } 1096 1095 } 1097 1096 … … 1121 1120 get_option('default_comment_status') 1122 1121 : $content_struct['mt_allow_comments']; 1123 1124 $ping_status = (empty($content_struct['mt_allow_pings'])) ?1125 get_option('default_ping_status')1126 : $content_struct['mt_allow_pings'];1127 1122 1128 1123 // Do some timestamp voodoo … … 1205 1200 'wp_slug' => $postdata['post_name'], 1206 1201 'wp_password' => $postdata['post_password'], 1207 'wp_author' => $author-> user_nicename,1202 'wp_author' => $author->display_name, 1208 1203 'wp_author_username' => $author->user_login 1209 1204 ); … … 1250 1245 1251 1246 // Get the post author info. 1252 $author = get_userdata($entry[' ID']);1247 $author = get_userdata($entry['post_author']); 1253 1248 1254 1249 $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; … … 1272 1267 'wp_slug' => $entry['post_name'], 1273 1268 'wp_password' => $entry['post_password'], 1274 'wp_author' => $author-> user_nicename,1269 'wp_author' => $author->display_name, 1275 1270 'wp_author_username' => $author->user_login 1276 1271 );
