Last active
November 8, 2019 19:27
-
-
Save jdeeburke/18ceb3788856a458b98873b9196a3126 to your computer and use it in GitHub Desktop.
WooCommerce Memberships & WooCommerce Follow-ups compatibility workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: WooCommerce Memberships ActionScheduler 3.0 Temporary Workaround | |
* Description: This is a temporary workaround to prevent fatal errors when using WooCommerce Memberships and WooCommerce Follow-up Emails. | |
* Author: SkyVerge | |
* Version: 1.0 | |
*/ | |
defined('ABSPATH') or exit; | |
$active_plugins = (array) get_option( 'active_plugins', array() ); | |
$memberships = 'woocommerce-memberships/woocommerce-memberships.php'; | |
$followup_emails = 'woocommerce-follow-up-emails/woocommerce-follow-up-emails.php'; | |
$early_load_files = array( | |
WP_PLUGIN_DIR . '/woocommerce-memberships/lib/prospress/action-scheduler/classes/abstracts/ActionScheduler_Logger.php', | |
WP_PLUGIN_DIR . '/woocommerce-memberships/lib/prospress/action-scheduler/classes/data-stores/ActionScheduler_wpCommentLogger.php' | |
); | |
// if memberships and followup emails are installed and marked 'active' in the database, | |
// and memberships is configured to use ActionScheduler 3.0+, attempt to early-load files. | |
if ( is_readable( WP_PLUGIN_DIR . '/' . $memberships ) | |
&& is_readable( WP_PLUGIN_DIR . '/' . $followup_emails ) | |
&& in_array( $memberships, $active_plugins, true ) | |
&& in_array( $followup_emails, $active_plugins, true ) | |
&& 'yes' === get_option( 'wc_memberships_use_as_3_0_0' ) ) { | |
foreach ( $early_load_files as $file ) { | |
if ( is_readable( $file ) ) { | |
require_once $file; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment