Ticket #1486: 1486.diff

File 1486.diff, 2.4 KB (added by westi, 6 years ago)

Patch updated against current trunk

  • wp-includes/post-template.php

     
    265265                parse_str($args, $r); 
    266266 
    267267        $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 
    268                 'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1); 
     268                'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1, 'authors' => ''); 
    269269        $r = array_merge($defaults, $r); 
    270270 
    271271        $output = ''; 
  • wp-includes/post.php

     
    10371037                parse_str($args, $r); 
    10381038 
    10391039        $defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 
    1040                                 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => ''); 
     1040                                'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => ''); 
    10411041        $r = array_merge($defaults, $r); 
    10421042        extract($r); 
    10431043 
     
    10751075        if (!empty($exclusions))  
    10761076                $exclusions .= ')'; 
    10771077 
     1078        $author_query = ''; 
     1079        if (!empty($authors)) { 
     1080                $post_authors = preg_split('/[\s,]+/',$authors); 
     1081                 
     1082                if (count($post_authors)) { 
     1083                        foreach($post_authors as $post_author) { 
     1084                                //Do we have an author id or an author login? 
     1085                                if (0 == intval($post_author)) { 
     1086                                        $post_author = get_profile('ID',$post_author); 
     1087                                } 
     1088                                if (! (0 == intval($post_author))) { 
     1089                                        if ('' == $author_query) { 
     1090                                                $author_query = ' post_author = ' . intval($post_author) . ' '; 
     1091                                        } else { 
     1092                                                $author_query .= ' OR post_author = ' . intval($post_author) . ' '; 
     1093                                        } 
     1094                                } 
     1095                        } 
     1096                        if (!('' == $author_query)) 
     1097                                $author_query = " AND ($author_query)"; 
     1098                } 
     1099        } 
     1100 
    10781101        $query = "SELECT * FROM $wpdb->posts " ; 
    10791102        $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;  
    10801103        $query .= " WHERE (post_type = 'page' AND post_status = 'publish') $exclusions $inclusions " ; 
    10811104        $query .= ( empty( $meta_key ) | empty($meta_value)  ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ; 
     1105        $query .= $author_query; 
    10821106        $query .= " ORDER BY " . $sort_column . " " . $sort_order ; 
    10831107 
    10841108        $pages = $wpdb->get_results($query);