diff --git a/.github/workflows/build-dev-artifact.yml b/.github/workflows/build-dev-artifact.yml index c3d9ddc7..f045bca4 100644 --- a/.github/workflows/build-dev-artifact.yml +++ b/.github/workflows/build-dev-artifact.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/hydrogen # 18.x + node-version: 18 cache: "yarn" - name: Install composer deps run: composer install --no-dev --prefer-dist --no-progress --no-suggest diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5391a3ab..1ffd3118 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/hydrogen # 18.x + node-version: 18 cache: "yarn" - name: Build run: | diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b1b9af5a..7f4748f1 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: lts/hydrogen # 18.x + node-version: 18 cache: "yarn" - name: Build run: | diff --git a/assets/src/Components/ImportModal.js b/assets/src/Components/ImportModal.js index 2ccb0aef..70cac968 100644 --- a/assets/src/Components/ImportModal.js +++ b/assets/src/Components/ImportModal.js @@ -543,6 +543,7 @@ const ImportModal = ( { frontPage: importData.front_page, shopPages: importData.shop_pages, paymentForms: importData.payment_forms, + masteriyoData: importData.masteriyo_data, demoSlug: importData.slug, editor, } ) diff --git a/includes/Importers/Content_Importer.php b/includes/Importers/Content_Importer.php index 6f2eebed..07ca31e3 100755 --- a/includes/Importers/Content_Importer.php +++ b/includes/Importers/Content_Importer.php @@ -162,6 +162,12 @@ public function import_remote_xml( WP_REST_Request $request ) { } do_action( 'themeisle_ob_after_payment_forms_setup' ); + // Set Masteriyo data. + if ( isset( $body['masteriyoData'] ) ) { + $this->setup_masteriyo( $body['masteriyoData'] ); + } + do_action( 'themeisle_ob_after_masteriyo_setup' ); + if ( empty( $frontpage_id ) ) { $this->logger->log( 'No front page ID.' ); } @@ -327,6 +333,33 @@ function ( $key ) { $this->logger->log( 'Payment forms set up.', 'success' ); } + /** + * Set up Masteriyo data. + * + * @param array $data the masteriyo data. + */ + public function setup_masteriyo( $data ) { + if ( empty( $data ) || ! is_array( $data ) ) { + $this->logger->log( 'No Masteriyo data.', 'success' ); + return; + } + + $this->logger->log( 'Setting up Masteriyo data.', 'progress' ); + + if ( ! function_exists( 'masteriyo_set_setting' ) ) { + $this->logger->log( 'Masteriyo not installed.', 'success' ); + return; + } + + if ( isset( $data['settings'] ) ) { + foreach ( $data['settings'] as $key => $value ) { + masteriyo_set_setting( $key, $value ); + } + } + + $this->logger->log( 'Masteriyo data set up.', 'success' ); + } + /** * Maybe bust cache for elementor plugin. */ diff --git a/includes/Importers/Plugin_Importer.php b/includes/Importers/Plugin_Importer.php index 7ba69cda..d724871c 100755 --- a/includes/Importers/Plugin_Importer.php +++ b/includes/Importers/Plugin_Importer.php @@ -55,6 +55,7 @@ class Plugin_Importer { 'pods' => 'init.php', 'wp-full-stripe-free' => 'wp-full-stripe.php', 'wp-cloudflare-page-cache' => 'wp-cloudflare-super-page-cache.php', + 'learning-management-system' => 'lms.php', ); public function __construct() { @@ -174,6 +175,7 @@ private function remove_possible_redirects() { delete_transient( '_wc_activation_redirect' ); delete_transient( 'wpforms_activation_redirect' ); update_option( 'themeisle_blocks_settings_redirect', false ); + update_option( 'masteriyo_first_time_activation_flag', true ); } /** @@ -363,6 +365,11 @@ private function maybe_provide_activation_help( $slug, $path ) { add_filter( 'woocommerce_create_pages', array( $this, 'woocommerce_activation_pages' ) ); } + if ( $slug === 'learning-management-system' ) { + // hook into this filter to remove pages on activation of masteriyo + add_filter( 'masteriyo_create_pages', array( $this, 'masteriyo_activation_pages' ) ); + } + if ( $slug === 'estatik' ) { update_option( 'es_is_demo_executed', 1 ); } @@ -386,6 +393,24 @@ public function woocommerce_activation_pages( $pages ) { return $pages; } + /** + * Filter pages from masteriyo activation. + * + * @param array $pages List of pages to be created on activation. + * + * @return array + */ + public function masteriyo_activation_pages( $pages ) { + $filtered_pages = array( 'courses', 'checkout', 'account', 'learn', 'instructor-registration', 'instructors-list' ); + foreach ( $filtered_pages as $filter ) { + if ( isset( $pages[ $filter ] ) ) { + unset( $pages[ $filter ] ); + } + } + + return $pages; + } + /** * Check if plugin directory exists. * diff --git a/onboarding/src/Components/FeaturesList.js b/onboarding/src/Components/FeaturesList.js index c76ef445..88151265 100644 --- a/onboarding/src/Components/FeaturesList.js +++ b/onboarding/src/Components/FeaturesList.js @@ -114,6 +114,12 @@ const pluginCollection = [ pluginSlug: 'restrict-content', label: __('Membership Plugin', 'templates-patterns-collection'), description: __('Membership plugin that allows you to monetize content access.', 'templates-patterns-collection') + }, + { + id: 'learning-management-system', + pluginSlug: 'learning-management-system', + label: __('Masteriyo', 'templates-patterns-collection'), + description: __('Create and sell online courses with ease.', 'templates-patterns-collection') } ]; diff --git a/onboarding/src/Components/Steps/Import.js b/onboarding/src/Components/Steps/Import.js index 868fad06..70186102 100644 --- a/onboarding/src/Components/Steps/Import.js +++ b/onboarding/src/Components/Steps/Import.js @@ -160,6 +160,7 @@ const Import = ( { frontPage: importData.front_page, shopPages: importData.shop_pages, paymentForms: importData.payment_forms, + masteriyoData: importData.masteriyo_data, demoSlug: importData.slug, editor, } )