WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Export - Import bug (11 posts)

  1. Bart van Poll
    Member
    Posted 3 years ago #

    Hi,

    Beautiful plugin!

    I would like to copy the WordPress SEO settings from one multi-user blog to another (same domain). I have 33, so this would save me a lot of time...

    Exporting works, but importing it to the second blog does not.

    Settings could not be imported: Upload failed.

    Any idea?

    There is a bunch of other people who have same issue
    http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-import-setting-failed-on-multi-site-install-31-rc-1?replies=6#post-2058469

  2. diesel12
    Member
    Posted 3 years ago #

    Yep, unable to export a file and then import it on another blog ... :(

  3. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

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

  4. Bart van Poll
    Member
    Posted 3 years ago #

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

  5. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

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

  6. swbullis
    Member
    Posted 2 years ago #

    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.

  7. diesel12
    Member
    Posted 2 years ago #

    Experiencing same issue ... would love to migrate a bunch of users to this but we'll have to wait until this is sorted out. :)

  8. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  9. FlashUK
    Member
    Posted 2 years ago #

    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.

  10. FlashUK
    Member
    Posted 2 years ago #

    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 :)

  11. FlashUK
    Member
    Posted 2 years ago #

    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]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic