Hello,
I used your plugin and it works great !
I just have to change 2 things :
1) I change the dropdown list to have : Blogname (Blog URL)
2) I add a test to check if dir exists in copyr function
1) Dropdown list :
Inside sfr_clone_site_options.php, I change the function build_site_list. In the query, I change the where clause from stylesheet to blogname. I better identify Blogs by their name reither than their template stylesheet. And I modify Dropdown to show blogname and URL.
function build_site_list($name, $site_list, $selected = false) {
global $wpdb, $table_prefix;
$code = '<select name="'. $name .'" id="'. $name .'" style="width:450px;">';
foreach($site_list as $site) {
if ($site['blog_id'] == '1') {
continue;
}
$site_theme_folder = $wpdb->get_results("SELECT option_value as theme FROM ". $table_prefix . $site['blog_id'] . "_options WHERE option_name = 'blogname'; ");
$code .= '<option value="'. $site['blog_id'] .'">'. $site_theme_folder[0]->theme .' ('. $site['domain'] . $site['path'] . ')</option>';
}
$code .= '</select>';
return $code;
}
2) copyr function
While testing this plugin, I try to copy a new blog. But this blog has no upload and no folder inside ‘wp-content/blogs.dir/‘. So the copy failed because this folder doesn’t exists. So I modify the copyr function from sfr_clone_site_functions.php to check if dir exists before copying it !
function copyr( $source, $dest ) {
if ( is_file( $source ) ) {
$c = copy($source, $dest);
chmod($dest, 0777);
return $c;
} elseif ( !is_dir( $source ) ) {
return true;
}
if (!is_dir($dest)) {
$oldumask = umask(0);
mkdir($dest, 0777);
umask($oldumask);
}
$dir = dir($source);
while (false !== $entry = $dir->read()) {
if ($entry == "." || $entry == ".." ) {
continue;
}
if ($dest !== "$source/$entry") {
copyr( $source."/".$entry, $dest."/".$entry ) ;
}
}
$dir->close();
return true;
}
I hope that this will help this plugin to be more usefull and robust for everyone.
Thank you for your good work !
]]>I can’t seem to understand what to put in the data entry fields.
There are NO choices in the pull-down menus.
The Clone site menu item is not showing up under any of the admin menus in the Network Admin area in WP 3.1.
]]>When I try to clone a site, I save all my settings but no sites are listed under Take this site:
]]>Hi all.
Hope this plug-in can help any dev working with WP multisite.
if you have any question / comments ? let me know.