Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 7 additions & 2 deletions assets/blocks/reader-registration/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ function register_block() {
* Enqueue front-end scripts.
*/
function enqueue_scripts() {
// No need to enqueue scripts if Reader Activation is disabled and not a preview request.
if ( ! Reader_Activation::allow_reg_block_render() ) {
$should_enqueue_scripts = Reader_Activation::allow_reg_block_render();
/**
* Filters whether to enqueue the reader registration block scripts.
*
* @param bool $should_enqueue_scripts Whether to enqueue the reader registration block scripts.
*/
if ( ! apply_filters( 'newspack_enqueue_reader_activation_block', $should_enqueue_scripts ) ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion includes/plugins/class-perfmatters.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private static function unused_css_excluded_stylesheets() {
'plugins/the-events-calendar', // The Events Calendar.
'plugins/events-calendar-pro', // The Events Calendar Pro.
'/themes/newspack-', // Any Newspack theme stylesheet.
'cache/perfmatters', // Perfmatters' cache.
'cache/perfmatters', // Perfmatters' cache.
'wp-includes',
];
}
Expand Down
9 changes: 7 additions & 2 deletions includes/plugins/wc-memberships/class-block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ public static function init() {
* Enqueue styles.
*/
public static function enqueue_styles() {
// Bail if Woo Memberships is not active.
if ( ! class_exists( 'WC_Memberships' ) ) {
$should_enqueue_styles = class_exists( 'WC_Memberships' );
/**
* Filters whether to enqueue the reader auth scripts.
*
* @param bool $should_enqueue_styles Whether to enqueue the reader auth scripts.
*/
if ( ! apply_filters( 'newspack_enqueue_memberships_block_patterns', $should_enqueue_styles ) ) {
return false;
}
wp_enqueue_style(
Expand Down
17 changes: 17 additions & 0 deletions includes/reader-activation/class-reader-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ public static function init() {
* Enqueue front-end scripts.
*/
public static function enqueue_scripts() {
/**
* Filters whether to enqueue the reader auth scripts.
*
* @param bool $allow_reg_block_render Whether to allow the registration block to render.
*/
if ( ! apply_filters( 'newspack_reader_activation_should_render_auth', true ) ) {
return;
}

$authenticated_email = '';
if ( \is_user_logged_in() && self::is_user_reader( \wp_get_current_user() ) ) {
$authenticated_email = \wp_get_current_user()->user_email;
Expand Down Expand Up @@ -1003,6 +1012,14 @@ public static function render_honeypot_field( $placeholder = '' ) {
* @param boolean $is_inline If true, render the form inline, otherwise render as a modal.
*/
public static function render_auth_form( $is_inline = false ) {
/**
* Filters whether to render reader auth form.
*
* @param bool $should_render Whether to render reader auth form.
*/
if ( ! apply_filters( 'newspack_reader_activation_should_render_auth', true ) ) {
return;
}
// No need to render if RAS is disabled and not a preview request.
if ( ! self::allow_reg_block_render() ) {
return;
Expand Down