From a8d3c01e1ff0fc5ad2d4a66e0e1e47a85a82eae5 Mon Sep 17 00:00:00 2001 From: ashubawork Date: Mon, 3 Apr 2023 11:55:40 +0300 Subject: [PATCH] - fix restrictions for module --- includes/admin/assets/js/um-admin-blocks.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/admin/assets/js/um-admin-blocks.js b/includes/admin/assets/js/um-admin-blocks.js index f6161b61..30007284 100644 --- a/includes/admin/assets/js/um-admin-blocks.js +++ b/includes/admin/assets/js/um-admin-blocks.js @@ -20,6 +20,7 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_default', um_condition_fields ); return function( props ) { + let initialIsRestrict = props.attributes.um_is_restrict !== undefined ? props.attributes.um_is_restrict : false; if ( props.attributes.um_is_restrict !== true ) { um_condition_fields['um_who_access'] = 'um_block_settings_hide'; @@ -72,7 +73,7 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc wp.components.ToggleControl, { label: wp.i18n.__( 'Restrict access?', 'ultimate-member' ), - checked: props.attributes.um_is_restrict, + checked: initialIsRestrict, onChange: function onChange( value ) { props.setAttributes({ um_is_restrict: value }); if ( value === false ) {