Moved Sites, Lost Settings #77

Closed
vanpop opened this Issue Oct 20, 2011 · 16 comments

Projects

None yet

5 participants

@vanpop
Contributor
vanpop commented Oct 20, 2011

Exported a multisite DB that has options framework plugin working on many sites. Imported the SQL, but only see default settings for each site on it's settings page. I found that the DB has the data after the import, and it looks correct, but once I visit a subsite's options framework settings page, the values are overwritten in the DB by the defaults.

If I comment out the "optionsframework_setdefaults();" line at around 152 in options-framework.php, the settings aren't overwritten in the DB after visiting the site settings page, but they aren't displayed on the settings page either.

@devinsays
Owner

Interesting. I would assume the SQL export would be exactly the same.

The code checks to see if the theme name (or unique theme id) is already saved in the options framework settings:

$optionsframework_settings = get_option('optionsframework');
$option_name = $optionsframework_settings['id'];

If it's not there yet (or if it's empty because the settings have been deleted), it sets the defaults.

It might be an order of operations issue. What happens if you deactive the plugin, import the database, and then reactivate the plugin? Can you verify that the plugin and theme options are exactly the same at that point? Then, when you reactivate, is that the point where options are deleted?

@vanpop
Contributor
vanpop commented Oct 20, 2011

Yeah, same here. It's been driving me crazy all day. The SQL import does look exactly the same. The unique theme ID is there, all of the data is there. So weird.

I'm going to try the deactivating/reactivating now. I'll let you know how it goes.

@vanpop
Contributor
vanpop commented Oct 20, 2011

Actually, just realized, the plugin is activated in the full import. I'll have to deactivate, export, and then re-import.

@devinsays
Owner

Yes, or just rename it in the directory of the new site so it can't activate.

@vanpop
Contributor
vanpop commented Oct 20, 2011

Ha. Right. Good thinking!

Ok, I imported the DB with the plugin disabled, and the options framework stuff looked good in the DB.

After network activating the plugin, the DB settings still look correct. It isn't until I visit the subsite's dashboard (or of settings page) that the settings are set to the defaults in the DB.

@devinsays
Owner

That's really strange. Sorry it's causing you issues. I'm headed to bed right now, but I'll look through the functions tomorrow to see if there's anything that might be triggering it. At the moment I have no idea why it would overwrite.

You have the exact same themes activated in the new install right, same code?

@vanpop
Contributor
vanpop commented Oct 20, 2011

No problem! I'm headed to bed also. Thanks for the great plugin and all of your help. I'll be playing with it again tomorrow-And yes, same theme, same exact code.

On Oct 20, 2011, at 12:27 AM, Devin Pricereply@reply.github.com wrote:

That's really strange. Sorry it's causing you issues. I'm headed to bed right now, but I'll look through the functions tomorrow to see if there's anything that might be triggering it. At the moment I have no idea why it would overwrite.

You have the exact same themes activated in the new install right, same code?

Reply to this email directly or view it on GitHub:
#77 (comment)

@vanpop
Contributor
vanpop commented Oct 20, 2011

Actually just realized, it doesn't reset the DB with defaults if you visit the dashboard, my mistake. Only happens when loading the of settings screen. -- Scratch that. It does set to defaults when viewing dashboard

@devinsays
Owner

Okay, that helps to close in on it.

So, after the SQL import you can visit the site and all the options appear to be set correctly? You can get a var_dump of all the saved options and they are able to be accessed?

Then, when you visit the options framework admin page for the first time after the import- that's when the reset happens?

@vanpop
Contributor
vanpop commented Oct 20, 2011

Further experimenting led me to find that the uploaded file field url's seem to be what is stopping $settings = get_option($option_name); from returning a value. It looks like the serialization is broken when importing (even though I'm doing a straight SQL import, not through WP). The character counts are incorrect.

@vanpop
Contributor
vanpop commented Oct 20, 2011

Verified by running this script, which did fix the serialization, and then saved settings showed:

http://davidcoveney.com/575/php-serialization-fix-for-wordpress-migrations/

@vanpop
Contributor
vanpop commented Oct 21, 2011

Figured it out. The issue that occurs is that when the find and replace is run on the sql dump to switch to the new domain, the string is changed in the array, but not the character count that accompanies it, rendering them incorrect.

@vanpop vanpop closed this Oct 21, 2011
@jahvi
jahvi commented Oct 21, 2011

I was having the same problem, glad to know what was causing it thanks!

@devinsays
Owner

Glad you figured it out. I posted a link from the plugin page in case anyone else has the issue.

@stueynet

Yeah that script works. Thanks everyone!

@swaranan

i have a problem ..When i deactivate the plugin the whole option panel got disappear...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment