Ticket #13229: 13229-3.diff

File 13229-3.diff, 3.7 KB (added by markoheijnen, 2 years ago)

Build it up again with the latest revision. Removed the parameter. I still think it should be there but that is my opinion. The reason of the parameter is to disable it when an plugin developer want to. @t31os_ Thanks for the labels array hint. Didn't thouht about that

  • wp-includes/ms-functions.php

     
    839839                update_user_meta( $user_id, 'primary_blog', $blog_id ); 
    840840 
    841841        restore_current_blog(); 
    842         do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id ); 
     842        do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta ); 
    843843 
    844844        return $blog_id; 
    845845} 
  • wp-admin/admin-ajax.php

     
    12651265        if ( empty($_POST['ps']) ) 
    12661266                exit; 
    12671267 
    1268         $what = isset($_POST['pages']) ? 'page' : 'post'; 
     1268        if(!empty($_POST['post_type']) && in_array($_POST['post_type'], get_post_types(array() ))) { 
     1269                $what = $_POST['post_type']; 
     1270        } else { 
     1271                $what = 'post'; 
     1272        } 
     1273 
    12691274        $s = stripslashes($_POST['ps']); 
    12701275        preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); 
    12711276        $search_terms = array_map('_search_terms_tidy', $matches[0]); 
     
    12821287 
    12831288        $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" ); 
    12841289 
    1285         if ( ! $posts ) 
    1286                 exit( __('No posts found.') ); 
     1290        if ( ! $posts ) { 
     1291                $posttype = get_post_type_object($what); 
     1292                exit($posttype->labels->not_found); 
     1293        } 
    12871294 
    12881295        $html = '<table class="widefat" cellspacing="0"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th>'.__('Date').'</th><th>'.__('Status').'</th></tr></thead><tbody>'; 
    12891296        foreach ( $posts as $post ) { 
  • wp-admin/includes/template.php

     
    32783278                                <input type="text" id="find-posts-input" name="ps" value="" /> 
    32793279                                <input type="button" onclick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br /> 
    32803280 
    3281                                 <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" /> 
     3281                                <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="post" /> 
    32823282                                <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label> 
    3283                                 <input type="radio" name="find-posts-what" id="find-posts-pages" value="pages" /> 
     3283                                <input type="radio" name="find-posts-what" id="find-posts-pages" value="page" /> 
    32843284                                <label for="find-posts-pages"><?php _e( 'Pages' ); ?></label> 
     3285 
     3286                                <?php 
     3287                                $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); 
     3288                                foreach ($post_types AS $post) { 
     3289                                ?> 
     3290                                <input type="radio" name="find-posts-what" id="find-posts-<?php echo esc_attr($post->name); ?>" value="<?php echo $post->name; ?>" /> 
     3291                                <label for="find-posts-<?php echo esc_attr($post->name); ?>"><?php echo $post->label; ?></label> 
     3292                                <?php 
     3293                                } ?> 
    32853294                        </div> 
    32863295                        <div id="find-posts-response"></div> 
    32873296                </div> 
  • wp-admin/js/media.dev.js

     
    3131                                _ajax_nonce: $('#_ajax_nonce').val() 
    3232                        }; 
    3333 
    34                         if ( $('#find-posts-pages').is(':checked') ) { 
    35                                 post['pages'] = 1; 
    36                         } else { 
    37                                 post['posts'] = 1; 
    38                         } 
     34                        var selectedItem; 
     35                        $("input[@name='itemSelect[]']:checked").each(function() { selectedItem = $(this).val() }); 
     36                        post['post_type'] = selectedItem; 
     37 
    3938                        $.ajax({ 
    4039                                type : 'POST', 
    4140                                url : ajaxurl,