From 328de82d60ac2f66c0c9ca77c958e3ca2ab93e23 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 18 Jan 2024 16:00:11 +0200 Subject: [PATCH] - added UM_DEV_MODE constant -> display Experimental features; --- includes/admin/class-enqueue.php | 2 +- includes/admin/core/class-admin-metabox.php | 2 +- includes/admin/core/class-admin-settings.php | 26 +++++++++++++++++--- ultimate-member.php | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/includes/admin/class-enqueue.php b/includes/admin/class-enqueue.php index dba671c6..01118a53 100644 --- a/includes/admin/class-enqueue.php +++ b/includes/admin/class-enqueue.php @@ -555,7 +555,7 @@ final class Enqueue extends \um\common\Enqueue { wp_enqueue_style( 'um_admin_common' ); if ( self::$um_cpt_form_screen ) { - if ( defined( 'UM_LEGACY_BUILDER_OFF' ) && UM_LEGACY_BUILDER_OFF ) { + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE && UM()->options()->get( 'enable_new_form_builder' ) ) { // Do new assets. } else { $this->load_builder(); diff --git a/includes/admin/core/class-admin-metabox.php b/includes/admin/core/class-admin-metabox.php index 96546ada..f48dcad8 100644 --- a/includes/admin/core/class-admin-metabox.php +++ b/includes/admin/core/class-admin-metabox.php @@ -1021,7 +1021,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) { public function add_metabox_form() { add_meta_box( 'submitdiv', __( 'Publish', 'ultimate-member' ), array( $this, 'custom_submitdiv' ), 'um_form', 'side', 'high' ); - if ( defined( 'UM_LEGACY_BUILDER_OFF' ) && UM_LEGACY_BUILDER_OFF ) { + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE && UM()->options()->get( 'enable_new_form_builder' ) ) { // Do new metabox. } else { add_meta_box( 'um-admin-form-mode', __( 'Select Form Type', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' ); diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 1531c22d..275a2358 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -2025,11 +2025,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'description' => __( 'These features are either experimental or incomplete, enable them at your own risk!', 'ultimate-member' ), 'fields' => array( array( - 'id' => 'disable_legacy_fonicons', + 'id' => 'enable_new_ui', + 'type' => 'checkbox', + 'label' => __( 'Design scheme', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable new UI (for developers only)', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable new UI.', 'ultimate-member' ), + ), + array( + 'id' => 'enable_new_form_builder', + 'type' => 'checkbox', + 'label' => __( 'Form Builder', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable new Form Builder (for developers only)', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable new Form Builder.', 'ultimate-member' ), + ), + array( + 'id' => 'enable_legacy_fonticons', 'type' => 'checkbox', 'label' => __( 'Legacy fonticons', 'ultimate-member' ), - 'checkbox_label' => __( 'Disable legacy fonticons', 'ultimate-member' ), - 'description' => __( 'Check this box if you would like to disable legacy Ultimate Member fonticons used outdated versions of FontAwesome and Ionicons libraries.', 'ultimate-member' ), + 'checkbox_label' => __( 'Enable legacy fonticons', 'ultimate-member' ), + 'description' => __( 'Check this box if you would like to enable legacy Ultimate Member fonticons used outdated versions of FontAwesome and Ionicons libraries.', 'ultimate-member' ), ), ), ), @@ -2062,6 +2076,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { ), // @todo remove since 2.9.0 ) ); + + if ( defined( 'UM_DEV_MODE' ) && UM_DEV_MODE ) { + + } else { + unset( $this->settings_structure['advanced']['sections']['features']['form_sections']['beta_features'] ); + } } /** diff --git a/ultimate-member.php b/ultimate-member.php index 82bb8b5f..b08fcaeb 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -32,7 +32,7 @@ define( 'UM_PATH', plugin_dir_path( __FILE__ ) ); define( 'UM_PLUGIN', plugin_basename( __FILE__ ) ); define( 'UM_VERSION', $plugin_data['Version'] ); define( 'UM_PLUGIN_NAME', $plugin_data['Name'] ); -// define( 'UM_LEGACY_BUILDER_OFF', true ); +// define( 'UM_DEV_MODE', true ); require_once 'includes/class-functions.php'; require_once 'includes/class-init.php';