• Hi Manuel and Patricio, and thanks a lot for your plugin. It works very well. I’m using it for a client’s network that has about 50 sites already running and that creates new ones every week.

    One think that is missing in my opinion is a way to clone a site right from the Sites > Add New menu. This is where I go naturally when I want to create a new site. Then I remember that to clone a site I have to select it somewhere before.

    Here is just a simple change to your clone_input_admin that does the job :


    function clone_input_admin() {
    if( 'site-new-network' != get_current_screen()->base ){
    return;
    }

    if ( isset($_GET['clone_from']) ) {
    $selected = intval($_GET['clone_from']);
    } else {
    $selected = get_option('wpmuclone_default_blog');
    }
    ?><table><tr class="form-field" id="wpmuclone_row">
    <th scope="row">Cloner le site</th>
    <td><select name="wpmuclone_default_blog" id="wpmuclone_default_blog">
    <option value="0">Aucun</option>
    <?php
    $blog_list = wp_get_sites(array('limit' => 0 ));
    $main_blog_id = $this->get_main_blog_id();
    $blog_list_counter = 0;
    foreach ($blog_list as $blog) {
    if($blog['blog_id'] != $main_blog_id ){
    $blog_list_counter++;
    ?>
    <option value="<?php echo $blog['blog_id'];?>" <?php if ($selected == $blog['blog_id'] ){ ?> selected <?php } ?>><?php echo get_blog_details( $blog['blog_id'], 'blogname' )->blogname ; ?> ( <?php echo $blog['domain']; ?>)</option>
    <?php
    }
    }
    ?>
    </select></td></tr></table><?php

    echo <<<HTML
    <script type="text/javascript">
    jQuery(document).ready( function($) {
    $('#wpmuclone_row').prependTo('.form-table');
    });
    </script>
    HTML;

    }

    This code will replace the hidden input by the dropdown menu that is displayed in the Multisite Cloner Settings page.

    https://wordpress.org/plugins/multisite-cloner/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Patricio T

    (@pmtarantino)

    Hi Fab1en, if I understand correctly, this functionality is already on the plugin. If you go to your blogs list, on mouse over, there is a “Clone” link at the same lever of “Delete”.
    So, you don’t have to pre-select a blog to clone it, you click there and you go directly to clone that site.

    Thanks for your suggestion, anyway! We will consider it for the next version 🙂

    Thread Starter Fabien Quatravaux

    (@fab1en)

    Hi Patricio.
    Yes, almost : I have just added a drop-down list to select the blog to clone from on the “Sites > Add New” screen.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Clone a site in one shot’ is closed to new replies.