Home New Guten Forums WoodMart support forum The general settings are overwritten by the settings preset

The general settings are overwritten by the settings preset

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #663569

    compras-informatica
    Participant

    Dear Support Team,

    I have encountered an unexpected issue in the WoodMart settings panel which risks losing data in the theme’s general settings:

    Issue summary: When I create a Preset with role-based conditions (for example “Administrator”) and then, logged in as an Administrator, navigate to Settings → Theme Settings → General, the fields display the Preset’s values instead of the original general settings values. If I then click Save Changes, I inadvertently overwrite the global settings with the Preset values.

    Steps to reproduce:
    – Go to Settings → Theme Settings → Presets and create a Preset named “User Logged In” with the condition User role = Administrator (and the rest of roles).

    – Configure various values in that Preset (Header, Shop, colours, typography, layout, etc.).

    – While logged in as an Administrator, go to Settings → Theme Settings → General.

    – Observe that the General Settings fields automatically show the Preset values (rather than the values intended for non-logged-in users).

    – Click Save Changes and, upon reload, note that the original general settings have been replaced by the Preset values.

    Expected behaviour:

    – The General Settings screen should always display the global values, regardless of any Preset matching the current user’s role.

    – Preset conditions should only apply on the front end of the site and must not affect the admin interface for editing the general configuration.

    Actual behaviour:

    – The Preset values are injected into the general settings interface when the condition (e.g. “User is logged in”) is met by the editing user.

    – Saving then permanently replaces the general settings with those of the Preset.

    I have attached a screenshot showing the Preset with multiple role conditions and, upon loading the General Settings, the fields already populated with those conditional values.

    Could you please investigate this issue? Unintentionally overwriting the global settings leads to loss of prior customisation.

    Thank you in advance for your assistance.

    Attachments:
    You must be logged in to view attached files.
    #663582

    Artem Temos
    Keymaster

    Hello,

    Try to add the following PHP code snippet to the child theme functions.php file to fix this

    add_action( 'xts_active_options_presets', function ( $active_presets ) {
    	if ( isset( $_GET['page'] ) && 'xts_theme_settings' === $_GET['page'] ) { // phpcs:ignore
    		return array();
    	}
    
    	return $active_presets;
    });

    Kind Regards

    #663651

    compras-informatica
    Participant

    Hello,

    The problem has been solved with the provided code.

    Thank you very much.

    #663726

    Artem Temos
    Keymaster

    Great, you are always welcome! Feel free to contact us if you have any further questions.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘The general settings are overwritten by the settings preset’ is closed to new replies.