I have an Options menu created with the code from Chip Bennett tutorial, the old code, though, the one from like a year ago (the new one has a much better validation structure, but still, it works really nice).
This is the link to the tutorial:http://www.chipbennett.net/2011/02/17/incorporating-the-settings-api-in-wordpress-themes/
It is based on several tabs, each one with a submit-tabName and a reset-tabName button.
In my case, everything’s working right, except from three installs of the theme in three different URLs from three different customers.
On their case, all tabs save and reset their options fine, but clicking on Save button from the Homepage options tab resets all (!) options for all tabs. And this happens, till now, only in those 3 installations, without me being able to replicate that behavior in purpose.
Furthermore, when comparing the results in Debug bar, in the Queries for the malfunctioning install of the theme, I get this:
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('quadro_theme_options', 'a:112:{s:17:\"display_text_logo\";b:1;s:14:\"logo_image_url\";s:0:\"\";s:15:\"display_tagline\";b:0;s:12:\"topleft_logo\";b:0;s:17:\"favicon_image_url\";s:0:\"\";s:14:\"login_logo_url\";s:0:\"\";s:11:\"show_footer\";b:1;s:13:\"footer_layout\";s:1:\"4\";s:21:\"copyright_footer_text\";s:102:\"mINUSCULA Theme by <a rel=\"nofollow\" href=\"http://quadroideas.com\" title=\"Minuscula Theme\">Quadro</a>\";s:16:\"404_custom_title\";s:9:\"404 Error\";s:15:\"404_custom_text\";s:127:\"Oops! Looks like the page you were looking for isn\'t here. Don\'t feel blue... use the search tool and get wherever you want! :)\";s:18:\"top_sidebar_layout\";s:1:\"a\";s:24:\"contact_sidebar_position\";s:5:\"right\";s:22:\"show_blog_title_single\";b:1;s:17:\"blog_title_single\";s:4:\"Blog\";s:23:\"blog_description_single\";s:15:\"Our latest news\";s:24:\"blog_ribbon_color_single\";s:7:\"#e53f0b\";s:21:\"blog_sidebar_position\";s:5:\"right\";s:19:\"show_prevnext_title\";b:0;s:17:\"google_map_script\";b:1;s:14:\"display_slider\";b:1;s:12:\"slider_style\";s:12:\"large-slider\";s:16:\"cycle_transition\";s:4:\"fade\";s:22:\"slider_slides_quantity\";i:1;s:14:\"slider_timeout\";i:5000;s:14:\"display_slogan\";b:1;s:12:\"slogan_input\";s:75:\"I\'m your slogan. Use me to display a neat welcome message for your website.\";s:15:\"display_tophtml\";b:0;s:21:\"top_custom_html_input\";s:0:\"\";s:16:\"display_services\";b:0;s:15:\"display_recents\";b:1;s:19:\"recent_news_heading\";s:11:\"Recent News\";s:19:\"recent_news_tagline\";s:25:\"read my latest blog posts\";s:17:\"display_portfolio\";b:0;s:20:\"portfolio_categories\";a:0:{}s:14:\"portfolio_size\";s:5:\"Small\";s:18:\"portfolio_quantity\";i:3;s:17:\"portfolio_heading\";s:13:\"Our Portfolio\";s:17:\"portfolio_tagline\";s:22:\"browse my latest works\";s:28:\"portfolio_categories_display\";b:1;s:17:\"portfolio_infotag\";s:7:\"Client:\";s:21:\"portfolio_viewproject\";s:19:\"View Project →\";s:18:\"display_widgetarea\";b:0;s:23:\"homepage_widgets_layout\";s:1:\"c\";s:18:\"display_bottomhtml\";b:0;s:24:\"bottom_custom_html_input\";s:0:\"\";s:21:\"quadro_homepage_order\";s:63:\"tophtml,slogan,services,portfolio,recents,widgetarea,bottomhtml\";s:18:\"background_pattern\";s:4:\"none\";s:16:\"background_color\";s:7:\"#eeeeee\";s:19:\"main_color_selector\";s:7:\"#e53f0b\";s:20:\"links_color_selector\";s:7:\"#e53f0b\";s:20:\"hover_color_selector\";s:7:\"#ff9a1a\";s:15:\"menu_tabs_color\";s:7:\"#525252\";s:22:\"menu_color_selector[1]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[2]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[3]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[4]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[5]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[6]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[7]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[8]\";s:7:\"#e53f0b\";s:22:\"menu_color_selector[9]\";s:7:\"#e53f0b\";s:23:\"menu_color_selector[10]\";s:7:\"#e53f0b\";s:15:\"quadro_css_tbox\";s:0:\"\";s:23:\"enable_minusculas_magic\";b:1;s:9:\"logo_font\";s:25:\"Abel|font-family: \"Abel\";\";s:10:\"logo_fsize\";i:40;s:24:\"logo_text_color_selector\";s:4:\"#111\";s:13:\"tagline_fsize\";i:18;s:22:\"tagline_color_selector\";s:4:\"#555\";s:13:\"top_menu_font\";s:25:\"Abel|font-family: \"Abel\";\";s:10:\"menu_fsize\";i:14;s:13:\"headings_font\";s:25:\"Abel|font-family: \"Abel\";\";s:14:\"headings_fsize\";s:6:\"medium\";s:23:\"headings_color_selector\";s:4:\"#555\";s:11:\"slogan_font\";s:25:\"Abel|font-family: \"Abel\";\";s:12:\"slogan_fsize\";i:36;s:9:\"body_font\";s:47:\"none|font-family: Helvetica, Arial, sans-serif;\";s:10:\"body_fsize\";i:12;s:19:\"body_color_selector\";s:4:\"#111\";s:17:\"footer_text_color\";s:4:\"#fff\";s:7:\"send_to\";s:0:\"\";s:10:\"name_label\";s:4:\"Name\";s:11:\"email_label\";s:5:\"Email\";s:13:\"subject_label\";s:7:\"Subject\";s:12:\"button_label\";s:4:\"Send\";s:15:\"incorrect_email\";s:34:\"The email you entered is not valid\";s:15:\"missing_general\";s:27:\"Please, complete this field\";s:12:\"missing_name\";s:31:\"You forgot to fill in your name\";s:13:\"missing_email\";s:41:\"Your forgot to fill in your email address\";s:15:\"missing_subject\";s:33:\"You forgot to fill in the subject\";s:15:\"missing_message\";s:41:\"Please include some words in your message\";s:15:\"sending_success\";s:61:\"Thanks for contacting us! We will answer as soon as possible.\";s:10:\"mail_title\";s:23:\"Email from your Website\";s:10:\"mail_intro\";s:54:\"You have received a message through your contact form.\";s:9:\"mail_name\";s:5:\"From:\";s:15:\"mail_email_from\";s:14:\"Email address:\";s:12:\"mail_subject\";s:8:\"Subject:\";s:12:\"mail_message\";s:12:\"The message:\";s:7:\"digg_id\";s:0:\"\";s:11:\"dribbble_id\";s:0:\"\";s:11:\"facebook_id\";s:0:\"\";s:9:\"flickr_id\";s:0:\"\";s:9:\"forrst_id\";s:0:\"\";s:9:\"google_id\";s:0:\"\";s:6:\"rss_id\";s:0:\"\";s:12:\"sharethis_id\";s:0:\"\";s:8:\"skype_id\";s:0:\"\";s:10:\"skype_link\";s:0:\"\";s:10:\"twitter_id\";s:0:\"\";s:8:\"vimeo_id\";s:0:\"\";s:10:\"youtube_id\";s:0:\"\";}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)
Which is weird because it’s not doing that “INSERT INTO” with all the default options in any of my installs.
Here is a Gist with the relevant files:
https://gist.github.com/4692896
I’m clueless already, don’t know where else to look. Any one has any idea?
Thanks!!
EDIT: I forgot to add that in one of the cases, the database was being shared with another WP site, and re-installing the site over a fresh new database solved it. The other two sites, however, are on their own database. Could it be a case of a corrupted database? And could that be happening with just one of the option tabs?