Clone a site in one shot
-
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><?phpecho <<<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.
- The topic ‘Clone a site in one shot’ is closed to new replies.