Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@
exit;
}

if ( ! function_exists( 'stackable_multiple_plugins_check' ) ) {
// Prevent multiple Stackable plugin versions from being active simultaneously.
function stackable_multiple_plugins_check() {
if ( is_plugin_active( $GLOBALS['OTHER_STACKABLE_FILE'] ) ) {
deactivate_plugins( $GLOBALS['OTHER_STACKABLE_FILE'] );
}
}
}

if ( defined('STACKABLE_FILE') && STACKABLE_FILE !== __FILE__ && ! isset( $GLOBALS['OTHER_STACKABLE_FILE'] ) ) {
// Get relative file path of the other Stackable version.
preg_match( "#([^\/]*?\/plugin.php)$#", STACKABLE_FILE, $matches );
$GLOBALS['OTHER_STACKABLE_FILE'] = $matches[1];

register_activation_hook( __FILE__, 'stackable_multiple_plugins_check' );
}

// Freemius SDK: Auto deactivate the free version when activating the paid one.
if ( function_exists( 'sugb_fs' ) ) {
sugb_fs()->set_basename( true, __FILE__ );
Expand Down
Loading