From 92df8fac50da1e21cec553f3a0c906e96de6143a Mon Sep 17 00:00:00 2001 From: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Date: Mon, 7 Mar 2022 13:49:10 -0800 Subject: [PATCH] Add an mu-plugin for tweaking the Stream plugin to meet our needs (#172) For now this just replaces Stream's posts connector with our own modified version so that it will log post changes correctly when made in the block editor. Other tweaks may follow. --- mu-plugins/loader.php | 1 + .../stream-tweaks/class-connector-posts.php | 22 ++++++++++++ mu-plugins/stream-tweaks/index.php | 34 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 mu-plugins/stream-tweaks/class-connector-posts.php create mode 100644 mu-plugins/stream-tweaks/index.php diff --git a/mu-plugins/loader.php b/mu-plugins/loader.php index f57561faf..8bb6820c6 100644 --- a/mu-plugins/loader.php +++ b/mu-plugins/loader.php @@ -6,3 +6,4 @@ require_once __DIR__ . '/blocks/global-header-footer/blocks.php'; require_once __DIR__ . '/global-fonts/index.php'; require_once __DIR__ . '/skip-to/skip-to.php'; +require_once __DIR__ . '/stream-tweaks/index.php'; diff --git a/mu-plugins/stream-tweaks/class-connector-posts.php b/mu-plugins/stream-tweaks/class-connector-posts.php new file mode 100644 index 000000000..233187a57 --- /dev/null +++ b/mu-plugins/stream-tweaks/class-connector-posts.php @@ -0,0 +1,22 @@ +log ); // WordPressdotorg namespaced version. + + // Remove the default posts connector class if it has been initialized. + if ( isset( $connector_classes[ $new_posts_connector->name ] ) ) { + unset( $connector_classes[ $new_posts_connector->name ] ); + } + + if ( $new_posts_connector->is_dependency_satisfied() ) { + $connector_classes[ $new_posts_connector->name ] = $new_posts_connector; + } + + return $connector_classes; +}