Comments (6)
Somewhat tied to this (tc_get_default_options to be more precise):
https://wordpress.org/support/topic/featured-pages-and-qtranslate?replies=3
What happens:
qtranslateX filters ALL the db options when in front-end (file qtranslate_frontend.php), not sure if this is a good thing but still..
And we have this:
https://github.com/Nikeo/customizr/blob/master/inc/class-fire-utils.php#L208
(Not sure why we save the option when user is_logged_in)
So, when we get the default options (fron-tend and user is logged in) qtranslate filters the theme options, and it translates (for example) featured pages texts with qtranslate tags in the customize (our option), so say
featured_text_one = '[:de]de[:zh]zh'
becomes
featured_text_one = 'de'
(if you're showing the website in german)
then we update the options and the original option gets replaced.
In this case the "issue" could be solved making that update just when:
if ( is_admin() && current_user_can('edit_theme_options') )
which makes sense to me.
Also there should be something wrong anyways, shouldn't we update the def options once?
from customizr.
About updating the options. It's been coded like that to avoid any inconsistencies when the theme is updated.
A possible solution would be to update the defaults only on 'after_switch_theme'
from customizr.
Ok, but anyways don't you think we should update them just when current_user_can edit themes options and when is_admin()?
from customizr.
yep
from customizr.
I think the issue is here:
https://github.com/presscustomizr/customizr/blob/master/inc/class-fire-utils.php#L358
which is called, mainly when displaying notices here -> https://github.com/presscustomizr/customizr/blob/master/inc/admin/class-fire-admin_init.php#L290
The thing is that when we retrieve the options, before setting a single option value, we merge the "user options" with the defaults.
So we'll have a theme option looking like:
array( user_options_merged_with_defaults, (array)defaults ) (1)
(defaults array cached in the db when retrieving the default options)
while we should have:
array( user_options, (array) defaults ) (2)
right?
The solution in the upcoming PR will keep the default options in the db (as you love them :P).
About the update of the default options.. I still think we should limit it when is_admin
but, I think is something you should decide, 'cause I have not clear why we don't already do it, there might be something I'm missing ( https://github.com/presscustomizr/customizr/blob/master/inc/class-fire-utils.php#L216 )
Not a big deal anyway.
If you then decide to not store the def options anymore let me know and I will do another PR.
From my tests, this works, though I wonder if it's enough. I mean, I made my tests on my tc_theme_options value (which I reset many times in the past), so I'm not sure it has exactly this (1) form, it might contain some other malformed option which this PR will not correct.
I think ( let me know what you think ) we might add the "tc_theme_options" ( and maybe also the theme_mods for other purposes ) to the "System Info" (maybe not always visibile, with a button to "generate" this kind of report ).
from customizr.
Mmm, ok but the PR which should fix this isn't merged, remember it ;)
from customizr.
Related Issues (20)
- [PHP 8] error Uncaught ValueError: Unknown format specifier β;β in route to files/wp-content/themes/customizr-pro/core/czr-customize-ccat.php:966
- [performance] prevent loading flickity.min.css ?
- Conflict with OptimizePress3
- [header] top offset issue when user logged in.
- [WooCommerce] explore a better display of product groups
- Google Mobile friendly notice about preload delay for font awesome
- Mobile menΓΉ issue: is difficult to understand the menu can be scrolled. HOT 1
- Unsupported operand types: string / int (in class-fire-resources_fonts.php:190) HOT 1
- [header] when centered on desktop, the site title stays left aligned
- [WooCommerce] checkout checkboxes broken when Font Awesome is not loaded
- compatibility with Nimble Builder when using a site template, lazy load not triggered
- Using wp_cache_set() can break sites using persistent caching like Memcached.
- [accessibility] improve accessibility of checkbox toggle for slider options
- remove W3C deprecated attributes for script and style tags HOT 6
- Possible interfering with Jetpack plugin "Widget Cookies & Consent Banner" HOT 1
- Possible year picker conflict with plugin Fluent forms
- [PHP 8] Possible display issue with header tagline and social links
- javascript breaks with WooCommerce cross sell item at checkout HOT 1
- Using Tickets add-on for The Events Calendar breaks website
- WooCommerce : Make sure property WC()::cart exists
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from customizr.