Using "Site Creation Wizard" WP plugin which use to work before MultiDB install

Hi there,

I installed this plugin on some of my Multisite installations

http://wordpress.org/extend/plugins/site-creation-wizard/

and it use to copy ALL the contents of a template - theme, settings, plugin, content, images, - a good 98% of the site template.

Now after MultiDB install - it does not duplicate the post, pages, images, categories but still duplicates the theme, settings, plugins.

I did a 256 install on the live site and a 16 and 4096 on some test servers and got the same result.

Any inputs would be greatly appreciated!

  • DavidM

    Hi magakrav,

    I took a cursory glance at that plugin's code and couldn't really see why the content wouldn't copy over. It's very similar to our own New Blog Templates plugin actually.

    You mentioned it doesn't duplicate the content, but do the newly created sites begin with no content? The plugin code should be deleting existing content before duplicating, so it would help to know if that's being deleted or not.

    If possible, could you give the New Blog Templates plugin a quick try to see how/if it handles the copying of post data in your particular multisite?
    https://premium.wpmudev.org/project/new-blog-template

    It would simply help to determine if there's something else amiss if both plugins don't work in this case.

    Thanks,
    David

  • magakrav

    David,

    Thanks for the response. This is what I found

    "You mentioned it doesn't duplicate the content, but do the newly created sites begin with no content? The plugin code should be deleting existing content before duplicating, so it would help to know if that's being deleted or not."

    - I made a template site with full posts (80) pages (about us, contact us), galleries, images, post and tag categories, basically everything. When I run the site creation wizard, I noticed that only the wp_options table is updated as the post, post meta, etc. remain deleted.

    - Yes the plugin code does delete existing content before inserting

    $wpdb->query( "DELETE FROM $wpdb->commentmeta" );
    $wpdb->query( "DELETE FROM $wpdb->comments" );
    $wpdb->query( "DELETE FROM $wpdb->links" );
    $wpdb->query( "DELETE FROM $wpdb->postmeta" );
    $wpdb->query( "DELETE FROM $wpdb->posts" );
    $wpdb->query( "DELETE FROM $wpdb->term_relationships" );
    $wpdb->query( "DELETE FROM $wpdb->term_taxonomy" );
    $wpdb->query( "DELETE FROM $wpdb->terms" );
    $wpdb->query( "INSERT INTO $wpdb->commentmeta SELECT * FROM {$type_option_model_blog_prefix}commentmeta" );
    $wpdb->query( "INSERT INTO $wpdb->comments SELECT * FROM {$type_option_model_blog_prefix}comments" );
    $wpdb->query( "INSERT INTO $wpdb->links SELECT * FROM {$type_option_model_blog_prefix}links" );
    $wpdb->query( "INSERT INTO $wpdb->postmeta SELECT * FROM {$type_option_model_blog_prefix}postmeta" );
    $wpdb->query( "INSERT INTO $wpdb->posts SELECT * FROM {$type_option_model_blog_prefix}posts" );

    $wpdb->query( "INSERT INTO $wpdb->commentmeta SELECT * FROM wp_23_commentmeta" );
    $wpdb->query( "INSERT INTO $wpdb->comments SELECT * FROM wp_23_comments" );
    $wpdb->query( "INSERT INTO $wpdb->links SELECT * FROM wp_23_links" );
    $wpdb->query( "INSERT INTO $wpdb->postmeta SELECT * FROM wp_23_postmeta" );
    $wpdb->query( "INSERT INTO $wpdb->posts SELECT * FROM wp_23_posts" );
    $date = date('Y-m-d H:i:s');
    $gmdate = gmdate('Y-m-d H:i:s');
    $wpdb->query( "UPDATE $wpdb->posts SET post_author = $userid, post_date = '$date', post_modified = '$date', post_date_gmt = '$gmdate', post_modified_gmt = '$gmdate'" );
    //echo "

    INSERT INTO $wpdb->posts SELECT * FROM {$type_option_model_blog_prefix}posts

    ";
    $wpdb->query( "INSERT INTO $wpdb->term_relationships SELECT * FROM {$type_option_model_blog_prefix}term_relationships" );
    $wpdb->query( "INSERT INTO $wpdb->term_taxonomy SELECT * FROM {$type_option_model_blog_prefix}term_taxonomy" );
    $wpdb->query( "INSERT INTO $wpdb->terms SELECT * FROM {$type_option_model_blog_prefix}terms" );

    "If possible, could you give the New Blog Templates plugin a quick try to see how/if it handles the copying of post data in your particular multisite?
    https://premium.wpmudev.org/project/new-blog-template"

    - Did exactly as advised and created a site using the template -> IT WORKS all content, images, posts, categories successfully duplicated onto new site.

    So there is definitely something amiss with the site creation plugin.

    Any ideas how I can rectify this?

    Many thanks!

  • magakrav

    Kindly ignore previous code, here is the original

    switch_to_blog( $new_blog_id );
    $wpdb->query( "DELETE FROM $wpdb->commentmeta" );
    $wpdb->query( "DELETE FROM $wpdb->comments" );
    $wpdb->query( "DELETE FROM $wpdb->links" );
    $wpdb->query( "DELETE FROM $wpdb->postmeta" );
    $wpdb->query( "DELETE FROM $wpdb->posts" );
    $wpdb->query( "DELETE FROM $wpdb->term_relationships" );
    $wpdb->query( "DELETE FROM $wpdb->term_taxonomy" );
    $wpdb->query( "DELETE FROM $wpdb->terms" );

    $wpdb->query( "INSERT INTO $wpdb->commentmeta SELECT * FROM {$type_option_model_blog_prefix}commentmeta" );
    $wpdb->query( "INSERT INTO $wpdb->comments SELECT * FROM {$type_option_model_blog_prefix}comments" );
    $wpdb->query( "INSERT INTO $wpdb->links SELECT * FROM {$type_option_model_blog_prefix}links" );
    $wpdb->query( "INSERT INTO $wpdb->postmeta SELECT * FROM {$type_option_model_blog_prefix}postmeta" );
    $wpdb->query( "INSERT INTO $wpdb->posts SELECT * FROM {$type_option_model_blog_prefix}posts" );
    $date = date('Y-m-d H:i:s');
    $gmdate = gmdate('Y-m-d H:i:s');
    $wpdb->query( "UPDATE $wpdb->posts SET post_author = $userid, post_date = '$date', post_modified = '$date', post_date_gmt = '$gmdate', post_modified_gmt = '$gmdate'" );
    //echo "

    INSERT INTO $wpdb->posts SELECT * FROM {$type_option_model_blog_prefix}posts
    ";
    $wpdb->query( "INSERT INTO $wpdb->term_relationships SELECT * FROM {$type_option_model_blog_prefix}term_relationships" );
    $wpdb->query( "INSERT INTO $wpdb->term_taxonomy SELECT * FROM {$type_option_model_blog_prefix}term_taxonomy" );
    $wpdb->query( "INSERT INTO $wpdb->terms SELECT * FROM {$type_option_model_blog_prefix}terms" );
    restore_current_blog();

  • magakrav

    Hi Aaron,

    I did try the new blog template plugin

    DavidM - "If possible, could you give the New Blog Templates plugin a quick try to see how/if it handles the copying of post data in your particular multisite?
    https://premium.wpmudev.org/project/new-blog-template"

    MK -" Did exactly as advised and created a site using the template -> IT WORKS all content, images, posts, categories successfully duplicated onto new site."

    I need a plugin that will allow my new registrants to choose a template when registering and new blog template does not do that (new blogs can be created by the network admin only)

    "INSERT -> SELECT cannot be supported by multidb because it has to pull from a different db. That's a limit in mysql."

    Interesting that you say that - it does not copy posts but is able to copy the entire wp_options table of the template site- something is definitely transferring from the template site to the newly created site (themes, options, settings) not just the posts, postmeta or even the blogs.dir files.

    So there is no workaround for MultiDB to accommodate this? or will I have to tweak the plugins to do so?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.