Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce Memberships & WooCommerce Follow-ups compatibility workaround
<?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
You can’t perform that action at this time.