File tree Expand file tree Collapse file tree 3 files changed +28
-11
lines changed Expand file tree Collapse file tree 3 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -7407,6 +7407,11 @@ function _activate_plugin_event_hook() {
74077407 $this->apply_filters( 'deactivate_on_activation', true )
74087408 ) {
74097409 deactivate_plugins( $other_version_basename );
7410+ } else if ( $is_premium_version_activation ) {
7411+ /**
7412+ * To prevent the free version from loading before the premium version when both are active, remove the SDK reference associated with the free version if it's the newest.
7413+ */
7414+ fs_remove_sdk_reference_by_basename( $other_version_basename );
74107415 }
74117416 }
74127417
@@ -8202,16 +8207,7 @@ function _deactivate_plugin_hook() {
82028207 * @since 1.1.6
82038208 */
82048209 private function remove_sdk_reference() {
8205- global $fs_active_plugins;
8206-
8207- foreach ( $fs_active_plugins->plugins as $sdk_path => $data ) {
8208- if ( $this->_plugin_basename == $data->plugin_path ) {
8209- unset( $fs_active_plugins->plugins[ $sdk_path ] );
8210- break;
8211- }
8212- }
8213-
8214- fs_fallback_to_newest_active_sdk();
8210+ fs_remove_sdk_reference_by_basename( $this->_plugin_basename );
82158211 }
82168212
82178213 /**
Original file line number Diff line number Diff line change @@ -415,4 +415,25 @@ function fs_fallback_to_newest_active_sdk() {
415415 fs_update_sdk_newest_version ( $ newest_sdk_path , $ newest_sdk_data ->plugin_path );
416416 }
417417 }
418+ }
419+
420+ if ( ! function_exists ( 'fs_remove_sdk_reference_by_basename ' ) ) {
421+ /**
422+ * @author Leo Fajardo (@leorw)
423+ * @since 2.7.4
424+ *
425+ * @param string $plugin_basename
426+ */
427+ function fs_remove_sdk_reference_by_basename ( $ plugin_basename ) {
428+ global $ fs_active_plugins ;
429+
430+ foreach ( $ fs_active_plugins ->plugins as $ sdk_path => $ data ) {
431+ if ( $ plugin_basename == $ data ->plugin_path ) {
432+ unset( $ fs_active_plugins ->plugins [ $ sdk_path ] );
433+ break ;
434+ }
435+ }
436+
437+ fs_fallback_to_newest_active_sdk ();
438+ }
418439 }
Original file line number Diff line number Diff line change 1515 *
1616 * @var string
1717 */
18- $ this_sdk_version = '2.7.3.5 ' ;
18+ $ this_sdk_version = '2.7.3.6 ' ;
1919
2020 #region SDK Selection Logic --------------------------------------------------------------------
2121
You can’t perform that action at this time.
0 commit comments