Skip to content

Commit

Permalink
Subscriptions paywall: simplify access question (#37434)
Browse files Browse the repository at this point in the history
  • Loading branch information
simison committed May 17, 2024
1 parent 730e9fd commit 67349d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Subscription paywall: simplify paid access question for logged out subscribers
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ function get_paywall_blocks( $newsletter_access_level ) {
<!-- /wp:paragraph -->';
}
} else {
$access_question = get_paywall_access_question( $newsletter_access_level );
$access_question = $is_paid_post ? esc_html__( 'Already a paid subscriber?', 'jetpack' ) : esc_html__( 'Already a subscriber?', 'jetpack' );
$login_block = '<!-- wp:group {"style":{"typography":{"fontSize":"14px"}},"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-group" style="font-size:14px">
<!-- wp:jetpack/subscriber-login {"logInLabel":"' . $access_question . '"} /-->
Expand Down Expand Up @@ -1186,31 +1186,6 @@ function get_paywall_blocks( $newsletter_access_level ) {
';
}

/**
* Returns Get Access question for the paywall
*
* @param string $post_access_level The newsletter access level.
* @return string
*/
function get_paywall_access_question( $post_access_level ) {
switch ( $post_access_level ) {
case Abstract_Token_Subscription_Service::POST_ACCESS_LEVEL_PAID_SUBSCRIBERS:
case Abstract_Token_Subscription_Service::POST_ACCESS_LEVEL_PAID_SUBSCRIBERS_ALL_TIERS:
$tier = Jetpack_Memberships::get_post_tier();
if ( $tier !== null ) {
return sprintf(
// translators: Placeholder is the tier name
__( 'Already a higher-tier paid subscriber?', 'jetpack' ),
esc_html( $tier->post_title )
);
} else {
return esc_html__( 'Already a paid subscriber?', 'jetpack' );
}
default:
return esc_html__( 'Already a subscriber?', 'jetpack' );
}
}

/**
* Returns true if user is auth for subscriptions check, otherwise returns false.
*
Expand Down

0 comments on commit 67349d4

Please sign in to comment.