WordPress.org

Make WordPress Core

Ticket #41907: wordpress-importer.php.diff

File wordpress-importer.php.diff, 1.6 KB (added by xkon, 4 years ago)

Select option to mass assign entries

  • wordpress-importer.php

     
    263263<?php if ( ! empty( $this->authors ) ) : ?>
    264264        <h3><?php _e( 'Assign Authors', 'wordpress-importer' ); ?></h3>
    265265        <p><?php _e( 'To make it easier for you to edit and save the imported content, you may want to reassign the author of the imported item to an existing user of this site. For example, you may want to import all the entries as <code>admin</code>s entries.', 'wordpress-importer' ); ?></p>
     266        <p><?php _e( 'Assign all entries to:', 'wordpress-importer' ); ?>
     267                <?php
     268                        wp_dropdown_users( array( 'id' => 'select_assign_all_users', 'multi' => true, 'show_option_all' => __( '- Select -', 'wordpress-importer' ) ) );
     269                ?>
     270        </p>
    266271<?php if ( $this->allow_create_users() ) : ?>
    267272        <p><?php printf( __( 'If a new user is created by WordPress, a new password will be randomly generated and the new user&#8217;s role will be set as %s. Manually changing the new user&#8217;s details will be necessary.', 'wordpress-importer' ), esc_html( get_option('default_role') ) ); ?></p>
    268273<?php endif; ?>
     
    283288
    284289        <p class="submit"><input type="submit" class="button" value="<?php esc_attr_e( 'Submit', 'wordpress-importer' ); ?>" /></p>
    285290</form>
     291<script>
     292        (function($){
     293                $('#select_assign_all_users').change(function(){
     294                        var $value = $(this).val();
     295                        $('ol#authors select').each(function(){
     296                                $(this).val($value);
     297                        });
     298                });
     299        })(jQuery)
     300</script>
    286301<?php
    287302        }
    288303