Changeset 876

Show
Ignore:
Timestamp:
02/01/07 08:59:00 (2 years ago)
Author:
donncha
Message:

WP Merge to rev 4854

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/user.php

    r819 r876  
    4949                $option_name = $wpdb->prefix . $option_name; 
    5050        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. 
     55function 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; 
    5161} 
    5262 
  • trunk/wp-includes/wpmu-functions.php

    r866 r876  
    410410} 
    411411 
    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  
    420412function get_blogs_of_user( $id, $all = false ) { 
    421413        global $wpdb, $wpmuBaseTablePrefix; 
  • trunk/xmlrpc.php

    r873 r876  
    224224                                "wp_slug"                               => $page->post_name, 
    225225                                "wp_password"                   => $page->post_password, 
    226                                 "wp_author"                             => $author->user_nicename, 
     226                                "wp_author"                             => $author->display_name, 
    227227                                "wp_page_parent_id"             => $page->post_parent, 
    228228                                "wp_page_parent_title"  => $parent_title, 
     
    446446                } 
    447447 
    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()); 
    457449        } 
    458450 
     
    563555                $this->escape($args); 
    564556 
    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); 
    593575        } 
    594576 
     
    963945 
    964946          $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                } 
    965952 
    966953          $post_title = $content_struct['title']; 
     
    10921079 
    10931080                // 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                        } 
    10961095                } 
    10971096 
     
    11211120            get_option('default_comment_status') 
    11221121            : $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']; 
    11271122 
    11281123          // Do some timestamp voodoo 
     
    12051200          'wp_slug' => $postdata['post_name'], 
    12061201          'wp_password' => $postdata['post_password'], 
    1207           'wp_author' => $author->user_nicename, 
     1202          'wp_author' => $author->display_name, 
    12081203          'wp_author_username'  => $author->user_login 
    12091204            ); 
     
    12501245 
    12511246                        // Get the post author info. 
    1252                         $author = get_userdata($entry['ID']); 
     1247                        $author = get_userdata($entry['post_author']); 
    12531248 
    12541249                        $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; 
     
    12721267                                'wp_slug' => $entry['post_name'], 
    12731268                                'wp_password' => $entry['post_password'], 
    1274                                 'wp_author' => $author->user_nicename, 
     1269                                'wp_author' => $author->display_name, 
    12751270                                'wp_author_username' => $author->user_login 
    12761271                        );