Skip to content

Commit 3e3094e

Browse files
release: v1.2.23
- Integration for Masteriyo plugin
2 parents 137dc3e + 0617c32 commit 3e3094e

File tree

8 files changed

+69
-3
lines changed

8 files changed

+69
-3
lines changed

.github/workflows/build-dev-artifact.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup Node.js
2424
uses: actions/setup-node@v4
2525
with:
26-
node-version: lts/hydrogen # 18.x
26+
node-version: 18
2727
cache: "yarn"
2828
- name: Install composer deps
2929
run: composer install --no-dev --prefer-dist --no-progress --no-suggest

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Node.js
1313
uses: actions/setup-node@v4
1414
with:
15-
node-version: lts/hydrogen # 18.x
15+
node-version: 18
1616
cache: "yarn"
1717
- name: Build
1818
run: |

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Node.js
1919
uses: actions/setup-node@v4
2020
with:
21-
node-version: lts/hydrogen # 18.x
21+
node-version: 18
2222
cache: "yarn"
2323
- name: Build
2424
run: |

assets/src/Components/ImportModal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ const ImportModal = ( {
543543
frontPage: importData.front_page,
544544
shopPages: importData.shop_pages,
545545
paymentForms: importData.payment_forms,
546+
masteriyoData: importData.masteriyo_data,
546547
demoSlug: importData.slug,
547548
editor,
548549
} )

includes/Importers/Content_Importer.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ public function import_remote_xml( WP_REST_Request $request ) {
162162
}
163163
do_action( 'themeisle_ob_after_payment_forms_setup' );
164164

165+
// Set Masteriyo data.
166+
if ( isset( $body['masteriyoData'] ) ) {
167+
$this->setup_masteriyo( $body['masteriyoData'] );
168+
}
169+
do_action( 'themeisle_ob_after_masteriyo_setup' );
170+
165171
if ( empty( $frontpage_id ) ) {
166172
$this->logger->log( 'No front page ID.' );
167173
}
@@ -327,6 +333,33 @@ function ( $key ) {
327333
$this->logger->log( 'Payment forms set up.', 'success' );
328334
}
329335

336+
/**
337+
* Set up Masteriyo data.
338+
*
339+
* @param array $data the masteriyo data.
340+
*/
341+
public function setup_masteriyo( $data ) {
342+
if ( empty( $data ) || ! is_array( $data ) ) {
343+
$this->logger->log( 'No Masteriyo data.', 'success' );
344+
return;
345+
}
346+
347+
$this->logger->log( 'Setting up Masteriyo data.', 'progress' );
348+
349+
if ( ! function_exists( 'masteriyo_set_setting' ) ) {
350+
$this->logger->log( 'Masteriyo not installed.', 'success' );
351+
return;
352+
}
353+
354+
if ( isset( $data['settings'] ) ) {
355+
foreach ( $data['settings'] as $key => $value ) {
356+
masteriyo_set_setting( $key, $value );
357+
}
358+
}
359+
360+
$this->logger->log( 'Masteriyo data set up.', 'success' );
361+
}
362+
330363
/**
331364
* Maybe bust cache for elementor plugin.
332365
*/

includes/Importers/Plugin_Importer.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Plugin_Importer {
5555
'pods' => 'init.php',
5656
'wp-full-stripe-free' => 'wp-full-stripe.php',
5757
'wp-cloudflare-page-cache' => 'wp-cloudflare-super-page-cache.php',
58+
'learning-management-system' => 'lms.php',
5859
);
5960

6061
public function __construct() {
@@ -174,6 +175,7 @@ private function remove_possible_redirects() {
174175
delete_transient( '_wc_activation_redirect' );
175176
delete_transient( 'wpforms_activation_redirect' );
176177
update_option( 'themeisle_blocks_settings_redirect', false );
178+
update_option( 'masteriyo_first_time_activation_flag', true );
177179
}
178180

179181
/**
@@ -363,6 +365,11 @@ private function maybe_provide_activation_help( $slug, $path ) {
363365
add_filter( 'woocommerce_create_pages', array( $this, 'woocommerce_activation_pages' ) );
364366
}
365367

368+
if ( $slug === 'learning-management-system' ) {
369+
// hook into this filter to remove pages on activation of masteriyo
370+
add_filter( 'masteriyo_create_pages', array( $this, 'masteriyo_activation_pages' ) );
371+
}
372+
366373
if ( $slug === 'estatik' ) {
367374
update_option( 'es_is_demo_executed', 1 );
368375
}
@@ -386,6 +393,24 @@ public function woocommerce_activation_pages( $pages ) {
386393
return $pages;
387394
}
388395

396+
/**
397+
* Filter pages from masteriyo activation.
398+
*
399+
* @param array $pages List of pages to be created on activation.
400+
*
401+
* @return array
402+
*/
403+
public function masteriyo_activation_pages( $pages ) {
404+
$filtered_pages = array( 'courses', 'checkout', 'account', 'learn', 'instructor-registration', 'instructors-list' );
405+
foreach ( $filtered_pages as $filter ) {
406+
if ( isset( $pages[ $filter ] ) ) {
407+
unset( $pages[ $filter ] );
408+
}
409+
}
410+
411+
return $pages;
412+
}
413+
389414
/**
390415
* Check if plugin directory exists.
391416
*

onboarding/src/Components/FeaturesList.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ const pluginCollection = [
114114
pluginSlug: 'restrict-content',
115115
label: __('Membership Plugin', 'templates-patterns-collection'),
116116
description: __('Membership plugin that allows you to monetize content access.', 'templates-patterns-collection')
117+
},
118+
{
119+
id: 'learning-management-system',
120+
pluginSlug: 'learning-management-system',
121+
label: __('Masteriyo', 'templates-patterns-collection'),
122+
description: __('Create and sell online courses with ease.', 'templates-patterns-collection')
117123
}
118124
];
119125

onboarding/src/Components/Steps/Import.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ const Import = ( {
160160
frontPage: importData.front_page,
161161
shopPages: importData.shop_pages,
162162
paymentForms: importData.payment_forms,
163+
masteriyoData: importData.masteriyo_data,
163164
demoSlug: importData.slug,
164165
editor,
165166
} )

0 commit comments

Comments
 (0)