New Blog Templates - Not Copying SQL for Plugin Nextgen_Gallery

I've just installed New Blog Templates, works like a charm, what an amazing plugin!

It's successfully copying all of the settings for all my other plugins over to the new site, except for one...

My nextgen_galleries aren't being copied to the new site.

The correct tables for the new blog are present in the database, but the tables are empty.

Any suggestions?

  • belay

    Thanks for the response

    I've since discovered that whenever I create a new blog, it deletes the galleries (etc) from the template blog. Looking in the database, the table wp_$templateBlogID_ngg_gallery is cleared whenever I create a new blog.

    Using the latest versions of everything:
    New Blog Templates Version 2.2.2
    Nextgen Version 2.0.33
    Wordpress Version 3.7.1

    Have tried deleting the NGGallery folder and re-installing but no difference.

  • belay

    I got impatient and wrote a script to create two example galleries:

    <?php
    
    	add_action( 'wpmu_new_blog', 'new_blog');        
    
    	function new_blog($blog_id) {
    		create_example_gallery($blog_id);
    	}
    
    	function create_example_gallery($blog_id){
    		global $wpdb;
    		$table_prefix = 'wp_' . $blog_id . '_';
    
    		// Create the Gallery (Name, Title, Preview Image, Blog ID)
    		create_gallery('snowdonia', 'Snowdonia', 2, $blog_id );
    		create_gallery('himalaya', 'Himalaya', 24, $blog_id );
    
    		// Create the images (imageCount, file_name, gallery_id, table_prefix)
    		insert_gallery_images(5, 'snowdonia', 1, $table_prefix );
    		insert_gallery_images(26, 'himalaya', 2, $table_prefix );
    
    		 //Create the album
    		$wpdb->insert( $table_prefix.'ngg_album', array(
    			'name' => 'Example Album',
    			'slug' => 'example-album',
    			'previewpic' => 1,
    			'sortorder' => 'WyIxIiwiMyIsIjIiXQ==',
    			'pageid' => 0
    		  ) );
    	}
    
            // Create the Galleries
    	function create_gallery($name, $title, $preview, $blog_id){
    		 global $wpdb;
    		 $table_prefix = 'wp_' . $blog_id . '_';
    		 $wpdb->insert( $table_prefix.'ngg_gallery', array(
    				'name' => $name,
    				'slug' => $name,
    				'path' => 'wp-content/blogs.dir/'. $blog_id . '/files/' . $name,
    				'title' => $title,
    				'galdesc' => 'This is an example gallery for "' . $title . '".',
    				'pageid' => 0,
    				'previewpic' => $preview,
    				'author' => 1
    		));
    	} 
    
    	 // Create the Images
    	function insert_gallery_images($imageCount, $file_name, $gallery_id, $table_prefix){
    		 global $wpdb;
    		 for ($i = 0; $i < $imageCount; $i++) {
    			 $wpdb->insert( $table_prefix.'ngg_pictures', array(
    					'image_slug' => $file_name,
    					'post_id' => 0,
    					'galleryid' => $gallery_id,
    					'filename' => $file_name . '_' .$i. '.jpg',
    					'description' => 'You can use this space to describe your image',
    					'alttext' => $file_name,
    					'imagedate' => $now,
    					'exclude' => 0,
    					'sortorder' => 0,
    					'meta_data' => ''
    			));
    		 }
    	 }
    ?>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.