diff --git a/includes/plugins/class-teams-for-memberships.php b/includes/plugins/class-teams-for-memberships.php index 8720314649..6f3af9975a 100644 --- a/includes/plugins/class-teams-for-memberships.php +++ b/includes/plugins/class-teams-for-memberships.php @@ -22,6 +22,7 @@ class Teams_For_Memberships { public static function init() { add_filter( 'newspack_ras_metadata_keys', [ __CLASS__, 'add_teams_metadata_keys' ] ); add_filter( 'newspack_esp_sync_contact', [ __CLASS__, 'handle_esp_sync_contact' ] ); + add_filter( 'newspack_my_account_disabled_pages', [ __CLASS__, 'enable_members_area_for_team_members' ] ); } /** @@ -101,6 +102,26 @@ public static function handle_esp_sync_contact( $contact ) { return $contact; } + + /** + * Enable Members Area for team members only. Team owners/managers get access to the "Teams" menu instead. + * + * @param array $disabled_wc_menu_items Disabled WooCommerce menu items. + * + * @return array Updated disabled WooCommerce menu items. + */ + public static function enable_members_area_for_team_members( $disabled_wc_menu_items ) { + if ( ! function_exists( 'wc_memberships_for_teams_get_teams' ) ) { + return $disabled_wc_menu_items; + } + if ( + in_array( 'members-area', $disabled_wc_menu_items, true ) && + ! empty( \wc_memberships_for_teams_get_teams( \get_current_user_id(), [ 'role' => 'member' ] ) ) + ) { + $disabled_wc_menu_items = array_values( array_diff( $disabled_wc_menu_items, [ 'members-area' ] ) ); + } + return $disabled_wc_menu_items; + } } Teams_For_Memberships::init(); diff --git a/includes/reader-activation/class-reader-activation.php b/includes/reader-activation/class-reader-activation.php index 06abbcf2e6..67c79a57a0 100644 --- a/includes/reader-activation/class-reader-activation.php +++ b/includes/reader-activation/class-reader-activation.php @@ -1482,6 +1482,11 @@ public static function render_third_party_auth() { * @return string Filtered template path. */ public static function replace_woocommerce_auth_form( $template, $template_name ) { + // Allow template rewriting for `woocommerce-memberships-for-teams` plugin. This includes + // a link to join a team. + if ( is_int( stripos( $template, 'woocommerce-memberships-for-teams' ) ) ) { + return $template; + } if ( 'myaccount/form-login.php' === $template_name ) { $template = dirname( NEWSPACK_PLUGIN_FILE ) . '/includes/templates/reader-activation/login-form.php'; } diff --git a/includes/reader-revenue/my-account/style.scss b/includes/reader-revenue/my-account/style.scss index 6ecdaf500b..2fef59ffd7 100644 --- a/includes/reader-revenue/my-account/style.scss +++ b/includes/reader-revenue/my-account/style.scss @@ -125,7 +125,10 @@ } } - + // Fixes an issue with form display caused by Newspack Theme CSS. + .entry-content p { + word-wrap: normal; + } } /* stylelint-disable-next-line */