Viewing 10 replies - 1 through 10 (of 10 total)
  • Trace

    (@diesel12)

    Yep, unable to export a file and then import it on another blog … 🙁

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    Hmm I’ll look into it, not the highest priority though to be honest.

    Thread Starter Bart van Poll

    (@bartvanpoll)

    Hi Joost,
    I totally understand that. Not too many people with multi-user blogs I guess. Thanks for your reply, Bart

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    Hehe not just that, not too many people with multi-user blogs that use the import function 🙂

    Joost I would like to also request this fix.

    Thanks for the great plugin.

    FYI: To Others I believe donations to the author would be the best way to persuade this fix to receive a higher priority.

    Experiencing same issue … would love to migrate a bunch of users to this but we’ll have to wait until this is sorted out. 🙂

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    I’m guessing you’re talking about a different thing @diesel12, import works fine for AIOSEO etc. Just apparently not for the import from the SEO settings at the moment.

    FlashUK

    (@flashuk)

    Found the answer to this – WordPress MU denies .zip files by default.

    You need to go to:
    Network Admin > Settings > Upload file types

    Then add zip to the exception list.

    Then try again. You can now upload your settings file.

    FlashUK

    (@flashuk)

    On further investigation, I noticed that the file wasn’t importing properly (folder permissions).

    So I wrote a patch for the code in class-config.php.
    Line: 412

    $file = wp_handle_upload($_FILES['settings_import_file']);
    
    				if ( isset( $file['file'] ) && !is_wp_error($file) ) {
    					require_once (ABSPATH . 'wp-admin/includes/class-pclzip.php');
    					$zip = new PclZip( $file['file'] );
                        $upload_dir = wp_upload_dir();
    					$unzipped = $zip->extract( $upload_dir['path'] );
    					if ( $unzipped[0]['stored_filename'] == 'settings.ini' ) {
    						$options = parse_ini_file( $unzipped[0]['stored_filename'] , true );
    						foreach ($options as $name => $optgroup) {
    							if ($name != 'wpseo_taxonomy_meta') {
    								update_option($name, $optgroup);
    							} else {
    								update_option($name, json_decode( urldecode( $optgroup['wpseo_taxonomy_meta'] ), true ) );
    							}
    						}
    						@unlink( $file['file'] ); // Remove archive file
    
    						$content .= '<p><strong>'.__('Settings successfully imported.', 'wordpress-seo' ).'</strong></p>';
    					} else {
    						$content .= '<p><strong>'.__('Settings could not be imported:', 'wordpress-seo' ).' '.__('Unzipping failed.', 'wordpress-seo' ).'</strong></p>';
    					}
    				} else {
    					if ( is_wp_error($file) )
    						$content .= '<p><strong>'.__('Settings could not be imported:', 'wordpress-seo' ).' '.$file['error'].'</strong></p>';
    					else
    						$content .= '<p><strong>'.__('Settings could not be imported:', 'wordpress-seo' ).' '.__('Upload failed.', 'wordpress-seo' ).'</strong></p>';
    				}

    That works for MU but will need testing on standalone installations. It’s probably correct because it uses wp_upload_dir().

    Thanks for the great plugin as always 🙂

    FlashUK

    (@flashuk)

    UPDATE

    You will want this code instead. The error handling is a mess and would advise redoing it. This was a quick hack to get it working.

    [32 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Export – Import bug’ is closed to new replies.