PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9.1
4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 All 141 releases
← All changes | inc/Ajax/AddonsAjax.php +18 -8 4.4.9 → 4.4.9.1 View file →
@@ -90,17 +90,20 @@
90 90 $purchase_codes = LP_Settings::get_option( $this->addon_service->key_purchase_addons, array() );
91 91 $purchase_code = $purchase_codes[ $addon['slug'] ] ?? '';
92 92 }
93 93
94 - if ( $is_paid_addon && 'install' === $action ) {
95 - $purchase_info = $this->addon_service->validate_and_save_purchase_code( $addon['slug'], (string) $purchase_code );
96 - }
97 -
98 94 if ( ! empty( $addon['is_org'] ) ) {
99 95 $link_download = "{$this->addon_service->link_org}{$addon['slug']}.{$addon['version']}.zip";
100 96 } else {
101 - // Allow active key for site if site active on DB "updates" is empty.
102 - $this->addon_service->active_site( $addon['slug'], $purchase_code );
97 + if ( 'install' === $action ) {
98 + // Allow active key for site if site active on DB "updates" is empty.
99 + $this->addon_service->active_site( $addon['slug'], $purchase_code );
100 + }
101 +
102 + $purchase_info = $this->addon_service->validate_and_save_purchase_code(
103 + $addon['slug'],
104 + $purchase_code
105 + );
103 106 // Download addon from ThimPress server.
104 107 $path_file = $this->addon_service->download_from_thimpress( $addon, $purchase_code );
105 108 }
106 109
@@ -131,12 +134,19 @@
131 134 case 'deactivate':
132 135 $this->addon_service->deactivate( $addon );
133 136 break;
134 137 case 'update-purchase':
135 - $purchase_info = $this->addon_service->validate_and_save_purchase_code(
138 + // If empty, try key old activated
139 + if ( empty( $purchase_code ) ) {
140 + $purchase_codes = lp_settings::get_option( $this->addon_service->key_purchase_addons, array() );
141 + $purchase_code = $purchase_codes[ $addon['slug'] ] ?? '';
142 + }
143 +
144 + $this->addon_service->active_site(
136 145 $addon['slug'],
137 - (string) $purchase_code
146 + $purchase_code
138 147 );
148 + $purchase_info = $this->addon_service->validate_and_save_purchase_code( $addon['slug'], $purchase_code );
139 149 break;
140 150 default:
141 151 break;
142 152 }