diff --git a/admin/class-convertkit-admin-settings-restrict-content.php b/admin/class-convertkit-admin-settings-restrict-content.php index 28fd282a3..d4fdd08fc 100644 --- a/admin/class-convertkit-admin-settings-restrict-content.php +++ b/admin/class-convertkit-admin-settings-restrict-content.php @@ -99,6 +99,51 @@ public function register_fields() { ) ); + // Restrict by Tag. + add_settings_field( + 'subscribe_heading_tag', + __( 'Subscribe Heading', 'convertkit' ), + array( $this, 'text_callback' ), + $this->settings_key, + $this->name . '-tags', + array( + 'name' => 'subscribe_heading_tag', + 'label_for' => 'subscribe_heading_tag', + 'description' => array( + __( 'Displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), + ), + ) + ); + + add_settings_field( + 'subscribe_text_tag', + __( 'Subscribe Text', 'convertkit' ), + array( $this, 'textarea_callback' ), + $this->settings_key, + $this->name . '-tags', + array( + 'name' => 'subscribe_text_tag', + 'label_for' => 'subscribe_text_tag', + 'description' => array( + __( 'Displays text explaining why the content is only available to subscribers.', 'convertkit' ), + ), + ) + ); + + add_settings_field( + 'require_tag_login', + __( 'Require Login', 'convertkit' ), + array( $this, 'require_tag_login_callback' ), + $this->settings_key, + $this->name . '-tags', + array( + 'name' => 'require_tag_login', + 'label_for' => 'require_tag_login', + 'label' => __( 'When checked, subscribers are sent a code in an email to login after being subscribed and tagged.', 'convertkit' ), + 'description' => '', + ) + ); + // reCAPTCHA. add_settings_field( 'recaptcha_site_key', @@ -146,37 +191,6 @@ public function register_fields() { ) ); - // Restrict by Tag. - add_settings_field( - 'subscribe_heading_tag', - __( 'Subscribe Heading', 'convertkit' ), - array( $this, 'text_callback' ), - $this->settings_key, - $this->name . '-tags', - array( - 'name' => 'subscribe_heading_tag', - 'label_for' => 'subscribe_heading_tag', - 'description' => array( - __( 'Displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), - ), - ) - ); - - add_settings_field( - 'subscribe_text_tag', - __( 'Subscribe Text', 'convertkit' ), - array( $this, 'textarea_callback' ), - $this->settings_key, - $this->name . '-tags', - array( - 'name' => 'subscribe_text_tag', - 'label_for' => 'subscribe_text_tag', - 'description' => array( - __( 'Displays text explaining why the content is only available to subscribers.', 'convertkit' ), - ), - ) - ); - // All. add_settings_field( 'subscribe_button_label', @@ -229,7 +243,7 @@ public function register_fields() { __( 'Email Text', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name . '-products', + $this->name, array( 'name' => 'email_text', 'label_for' => 'email_text', @@ -244,7 +258,7 @@ public function register_fields() { __( 'Email Heading', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name . '-products', + $this->name, array( 'name' => 'email_heading', 'label_for' => 'email_heading', @@ -259,7 +273,7 @@ public function register_fields() { __( 'Email Field Description', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name . '-products', + $this->name, array( 'name' => 'email_description_text', 'label_for' => 'email_description_text', @@ -274,7 +288,7 @@ public function register_fields() { __( 'Email Button Label', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name . '-products', + $this->name, array( 'name' => 'email_button_label', 'label_for' => 'email_button_label', @@ -289,7 +303,7 @@ public function register_fields() { __( 'Email Check Heading', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name . '-products', + $this->name, array( 'name' => 'email_check_heading', 'label_for' => 'email_check_heading', @@ -304,7 +318,7 @@ public function register_fields() { __( 'Email Check Text', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name . '-products', + $this->name, array( 'name' => 'email_check_text', 'label_for' => 'email_check_text', @@ -319,7 +333,7 @@ public function register_fields() { __( 'No Access Text', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name . '-products', + $this->name, array( 'name' => 'no_access_text', 'label_for' => 'no_access_text', @@ -384,7 +398,7 @@ public function documentation_url() { } /** - * Renders the input for the Enable setting. + * Renders the input for the Permit Crawlers setting. * * @since 2.4.1 * @@ -403,6 +417,26 @@ public function permit_crawlers_callback( $args ) { } + /** + * Renders the input for the Require Login setting. + * + * @since 2.7.2 + * + * @param array $args Setting field arguments (name,description). + */ + public function require_tag_login_callback( $args ) { + + // Output field. + echo $this->get_checkbox_field( // phpcs:ignore WordPress.Security.EscapeOutput + $args['name'], + 'on', + $this->settings->require_tag_login(), // phpcs:ignore WordPress.Security.EscapeOutput + $args['label'], // phpcs:ignore WordPress.Security.EscapeOutput + $args['description'] // phpcs:ignore WordPress.Security.EscapeOutput + ); + + } + /** * Renders the input for the text setting. * diff --git a/includes/class-convertkit-ajax.php b/includes/class-convertkit-ajax.php index 5206f4966..c1a520977 100644 --- a/includes/class-convertkit-ajax.php +++ b/includes/class-convertkit-ajax.php @@ -178,14 +178,14 @@ public function subscriber_authentication_send_code() { // If an error occured, build the email form view with the error message. if ( is_wp_error( $output_restrict_content->error ) ) { ob_start(); - include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/product-modal-content-email.php'; + include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal-content-email.php'; $output = trim( ob_get_clean() ); wp_send_json_success( $output ); } // Build authentication code view to return for output. ob_start(); - include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/product-modal-content-code.php'; + include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal-content-code.php'; $output = trim( ob_get_clean() ); wp_send_json_success( $output ); @@ -209,7 +209,7 @@ public function subscriber_verification() { // If an error occured, build the code form view with the error message. if ( is_wp_error( $output_restrict_content->error ) ) { ob_start(); - include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/product-modal-content-code.php'; + include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal-content-code.php'; $output = trim( ob_get_clean() ); wp_send_json_error( $output ); } diff --git a/includes/class-convertkit-output-restrict-content.php b/includes/class-convertkit-output-restrict-content.php index f38331d65..fc5912d15 100644 --- a/includes/class-convertkit-output-restrict-content.php +++ b/includes/class-convertkit-output-restrict-content.php @@ -207,6 +207,42 @@ public function maybe_run_subscriber_authentication() { break; case 'tag': + // If require login is enabled, show the login screen. + if ( $this->restrict_content_settings->require_tag_login() ) { + // Tag the subscriber. + $result = $this->api->tag_subscribe( $this->resource_id, $email ); + + // Bail if an error occured. + if ( is_wp_error( $result ) ) { + $this->error = $result; + return; + } + + // Send email to subscriber with a link to authenticate they have access to the email address submitted. + $result = $this->api->subscriber_authentication_send_code( + $email, + $this->get_url() + ); + + // Bail if an error occured. + if ( is_wp_error( $result ) ) { + $this->error = $result; + return; + } + + // Clear any existing subscriber ID cookie, as the authentication flow has started by sending the email. + $subscriber = new ConvertKit_Subscriber(); + $subscriber->forget(); + + // Store the token so it's included in the subscriber code form. + $this->token = $result; + break; + } + + // If here, require login is disabled. + // Check reCAPTCHA, tag subscriber and assign subscriber ID integer to cookie + // without email link. + // If Google reCAPTCHA is enabled, check if the submission is spam. if ( $this->restrict_content_settings->has_recaptcha_site_and_secret_keys() ) { $response = wp_remote_post( @@ -835,6 +871,12 @@ private function subscriber_has_access( $subscriber_id ) { // phpcs:ignore Gener case 'tag': // If the subscriber ID is numeric, check using get_subscriber_tags(). if ( is_numeric( $subscriber_id ) ) { + // If require login is enabled, only a signed subscriber ID is accepted, as this is generated + // via the subscriber verify email flow. + if ( $this->restrict_content_settings->require_tag_login() ) { + return false; + } + return $this->subscriber_has_access_to_tag_by_subscriber_id( $subscriber_id, absint( $this->resource_id ) ); } @@ -1129,17 +1171,21 @@ private function get_call_to_action( $post_id ) { // phpcs:ignore Generic.CodeAn } + // Output code form if this request is after the user entered their email address, + // which means we're going through the authentication flow. + if ( $this->in_authentication_flow() ) { // phpcs:ignore WordPress.Security.NonceVerification + ob_start(); + include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/code.php'; + return trim( ob_get_clean() ); + } + // This is deliberately a switch statement, because we will likely add in support // for restrict by tag and form later. switch ( $this->resource_type ) { case 'product': - // Output product code form if this request is after the user entered their email address, - // which means we're going through the authentication flow. - if ( $this->in_authentication_flow() ) { // phpcs:ignore WordPress.Security.NonceVerification - ob_start(); - include CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/product-code.php'; - return trim( ob_get_clean() ); - } + // Get header and text from settings for Products. + $heading = $this->restrict_content_settings->get_by_key( 'subscribe_heading' ); + $text = $this->restrict_content_settings->get_by_key( 'subscribe_text' ); // Output product restricted message and email form. // Get Product. @@ -1159,7 +1205,7 @@ private function get_call_to_action( $post_id ) { // phpcs:ignore Generic.CodeAn 'wp_footer', function () { - include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/product-modal.php'; + include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; } ); @@ -1172,6 +1218,23 @@ function () { return trim( ob_get_clean() ); case 'tag': + // Get header and text from settings for Tags. + $heading = $this->restrict_content_settings->get_by_key( 'subscribe_heading_tag' ); + $text = $this->restrict_content_settings->get_by_key( 'subscribe_text_tag' ); + + // If require login is enabled and scripts are enabled, output the email login form in a modal, which will be displayed + // when the 'log in' link is clicked. + if ( $this->restrict_content_settings->require_tag_login() && ! $this->settings->scripts_disabled() ) { + add_action( + 'wp_footer', + function () { + + include_once CONVERTKIT_PLUGIN_PATH . '/views/frontend/restrict-content/login-modal.php'; + + } + ); + } + // Enqueue Google reCAPTCHA JS if site and secret keys specified. if ( $this->restrict_content_settings->has_recaptcha_site_and_secret_keys() ) { add_filter( diff --git a/includes/class-convertkit-settings-restrict-content.php b/includes/class-convertkit-settings-restrict-content.php index 9d1071f69..f90592068 100644 --- a/includes/class-convertkit-settings-restrict-content.php +++ b/includes/class-convertkit-settings-restrict-content.php @@ -77,6 +77,19 @@ public function permit_crawlers() { } + /** + * Returns whether login by email is required for Member Content by Tag functionality. + * + * @since 2.7.2 + * + * @return bool + */ + public function require_tag_login() { + + return ( $this->settings['require_tag_login'] === 'on' ? true : false ); + + } + /** * Returns the reCAPTCHA Site Key Plugin setting. * @@ -195,11 +208,6 @@ public function get_defaults() { // Permit Crawlers. 'permit_crawlers' => '', - // Google reCAPTCHA. - 'recaptcha_site_key' => '', - 'recaptcha_secret_key' => '', - 'recaptcha_minimum_score' => '0.5', - // Restrict by Product. 'subscribe_heading' => __( 'Read this post with a premium subscription', 'convertkit' ), 'subscribe_text' => __( 'This post is only available to premium subscribers. Join today to get access to all posts.', 'convertkit' ), @@ -207,6 +215,10 @@ public function get_defaults() { // Restrict by Tag. 'subscribe_heading_tag' => __( 'Subscribe to keep reading', 'convertkit' ), 'subscribe_text_tag' => __( 'This post is free to read but only available to subscribers. Join today to get access to all posts.', 'convertkit' ), + 'require_tag_login' => '', // blank|on. + 'recaptcha_site_key' => '', + 'recaptcha_secret_key' => '', + 'recaptcha_minimum_score' => '0.5', // All. 'subscribe_button_label' => __( 'Subscribe', 'convertkit' ), diff --git a/resources/frontend/js/restrict-content.js b/resources/frontend/js/restrict-content.js index d9ab7dceb..4f078e552 100644 --- a/resources/frontend/js/restrict-content.js +++ b/resources/frontend/js/restrict-content.js @@ -60,7 +60,6 @@ document.addEventListener( function convertKitRestrictContentTagFormSubmit( token ) { - console.log( token ); document.getElementById( 'convertkit-restrict-content-form' ).submit(); } diff --git a/tests/_support/Helper/Acceptance/ConvertKitRestrictContent.php b/tests/_support/Helper/Acceptance/ConvertKitRestrictContent.php index 223848033..c04b20db1 100644 --- a/tests/_support/Helper/Acceptance/ConvertKitRestrictContent.php +++ b/tests/_support/Helper/Acceptance/ConvertKitRestrictContent.php @@ -337,7 +337,7 @@ public function testRestrictedContentModalByProductOnFrontend($I, $urlOrPageID, } /** - * Run frontend tests for restricted content by ConvertKit Product, to confirm that visible and member's content + * Run frontend tests for restricted content by Kit Tag, to confirm that visible and member's content * is / is not displayed when logging in with valid and invalid subscriber email addresses. * * @since 2.1.0 @@ -416,13 +416,14 @@ public function testRestrictedContentByTagOnFrontend($I, $urlOrPageID, $emailAdd } /** - * Run frontend tests for restricted content by ConvertKit Product, to confirm that visible and member's content + * Run frontend tests for restricted content by Kit Tag, to confirm that visible and member's content * is / is not displayed when using signed subscriber IDs that do / do not have access to the content. * * @since 2.7.1 * * @param AcceptanceTester $I Tester. * @param string|int $urlOrPageID URL or ID of Restricted Content Page. + * @param string $emailAddress Email Address. * @param bool|array $options { * Optional. An array of settings. * @@ -432,7 +433,7 @@ public function testRestrictedContentByTagOnFrontend($I, $urlOrPageID, $emailAdd * } * @param bool $recaptchaEnabled Whether the reCAPTCHA settings are enabled in the Plugin settings. */ - public function testRestrictedContentByTagOnFrontendUsingSignedSubscriberID($I, $urlOrPageID, $options = false, $recaptchaEnabled = false) + public function testRestrictedContentByTagOnFrontendUsingSignedSubscriberID($I, $urlOrPageID, $emailAddress, $options = false, $recaptchaEnabled = false) { // Merge options with defaults. $options = $this->_getRestrictedContentOptionsWithDefaultsMerged($options); @@ -444,10 +445,6 @@ public function testRestrictedContentByTagOnFrontendUsingSignedSubscriberID($I, $I->amOnUrl($urlOrPageID); } - // Clear any existing cookie from a previous test and reload. - $I->resetCookie('ck_subscriber_id'); - $I->reloadPage(); - // Check that no PHP warnings or notices were output. $I->checkNoWarningsAndNoticesOnScreen($I); @@ -464,32 +461,41 @@ public function testRestrictedContentByTagOnFrontendUsingSignedSubscriberID($I, $I->see($options['text_items']['subscribe_text_tag']); $I->seeInSource('setCookie('ck_subscriber_id', $_ENV['CONVERTKIT_API_SIGNED_SUBSCRIBER_ID_NO_ACCESS']); - if ( is_numeric( $urlOrPageID ) ) { - $I->amOnPage('?p=' . $urlOrPageID . '&ck-cache-bust=' . microtime() ); - } else { - $I->amOnUrl($urlOrPageID . '?ck-cache-bust=' . microtime() ); - } + // Signup. + $I->waitForElementVisible('input#convertkit_email'); + $I->fillField('convertkit_email', $emailAddress); + $I->click('input.wp-block-button__link'); - // Confirm an inline error message is displayed. - $I->seeInSource('
' . $options['text_items']['no_access_text'] . '
'); - $I->seeInSource('
'); + // Wait for reCAPTCHA to fully load. + if ( $recaptchaEnabled ) { + $I->wait(3); + } + // Confirm that confirmation an email has been sent is displayed. // Confirm that the visible text displays, hidden text does not display and the CTA displays. - $I->see($options['visible_content']); + if ( ! empty($options['visible_content'])) { + $I->see($options['visible_content']); + } $I->dontSee($options['member_content']); - // Set cookie with signed subscriber ID that does have access to the tag, and reload the restricted content page. - $I->setCookie('ck_subscriber_id', $_ENV['CONVERTKIT_API_SIGNED_SUBSCRIBER_ID']); - if ( is_numeric( $urlOrPageID ) ) { - $I->amOnPage('?p=' . $urlOrPageID . '&ck-cache-bust=' . microtime() ); - } else { - $I->amOnUrl($urlOrPageID . '?ck-cache-bust=' . microtime() ); - } + // Confirm that the CTA displays with the expected text. + $I->seeElementInDOM('#convertkit-restrict-content'); + $I->seeInSource('

' . $options['text_items']['email_check_heading'] . '

'); + $I->see($options['text_items']['email_check_text']); + $I->seeElementInDOM('input#convertkit_subscriber_code'); + $I->seeElementInDOM('input.wp-block-button__link'); - // Confirm that the restricted content is now displayed. - $I->testRestrictContentDisplaysContent($I, $options); + // Enter an invalid code. + $I->fillField('subscriber_code', '999999'); + $I->click('Verify'); + + // Confirm an inline error message is displayed. + $I->seeInSource('
The entered code is invalid. Please try again, or click the link sent in the email.
'); + $I->seeInSource('
'); + + // Test that the restricted content displays when a valid signed subscriber ID is used, + // as if we entered the code sent in the email. + $this->testRestrictedContentShowsContentWithValidSubscriberID($I, $urlOrPageID, $options); } /** diff --git a/tests/acceptance/restrict-content/general/RestrictContentSettingsCest.php b/tests/acceptance/restrict-content/general/RestrictContentSettingsCest.php index 03bd1238b..7f695ed52 100644 --- a/tests/acceptance/restrict-content/general/RestrictContentSettingsCest.php +++ b/tests/acceptance/restrict-content/general/RestrictContentSettingsCest.php @@ -84,11 +84,6 @@ public function testSaveBlankSettings(AcceptanceTester $I) // Permit Crawlers. 'permit_crawlers' => '', - // Google reCAPTCHA. - 'recaptcha_site_key' => '', - 'recaptcha_secret_key' => '', - 'recaptcha_minimum_score' => '', - // Restrict by Product. 'subscribe_heading' => '', 'subscribe_text' => '', @@ -96,6 +91,10 @@ public function testSaveBlankSettings(AcceptanceTester $I) // Restrict by Tag. 'subscribe_heading_tag' => '', 'subscribe_text_tag' => '', + 'require_tag_login' => '', + 'recaptcha_site_key' => '', + 'recaptcha_secret_key' => '', + 'recaptcha_minimum_score' => '', // All. 'subscribe_button_label' => '', @@ -142,11 +141,6 @@ public function testSaveSettings(AcceptanceTester $I) // Permit Crawlers. 'permit_crawlers' => true, - // Google reCAPTCHA. - 'recaptcha_site_key' => 'reCAPTCHASiteKey', - 'recaptcha_secret_key' => 'reCAPTCHASecretKey', - 'recaptcha_minimum_score' => '0.8', - // Restrict by Product. 'subscribe_heading' => 'Subscribe Heading', 'subscribe_text' => 'Subscribe Text', @@ -154,6 +148,10 @@ public function testSaveSettings(AcceptanceTester $I) // Restrict by Tag. 'subscribe_heading_tag' => 'Subscribe Heading Tag', 'subscribe_text_tag' => 'Subscribe Text Tag', + 'require_tag_login' => 'on', + 'recaptcha_site_key' => 'reCAPTCHASiteKey', + 'recaptcha_secret_key' => 'reCAPTCHASecretKey', + 'recaptcha_minimum_score' => '0.8', // All. 'subscribe_button_label' => 'Subscribe Button Label', @@ -236,6 +234,7 @@ public function _setupConvertKitPluginRestrictContent($I, $settings = false) foreach ( $settings as $key => $value ) { switch ( $key ) { case 'permit_crawlers': + case 'require_tag_login': if ( $value ) { $I->checkOption('_wp_convertkit_settings_restrict_content[' . $key . ']'); } else { diff --git a/tests/acceptance/restrict-content/general/RestrictContentTagCest.php b/tests/acceptance/restrict-content/general/RestrictContentTagCest.php index 36dcb6d18..e53df8875 100644 --- a/tests/acceptance/restrict-content/general/RestrictContentTagCest.php +++ b/tests/acceptance/restrict-content/general/RestrictContentTagCest.php @@ -56,17 +56,78 @@ public function testRestrictContentByTag(AcceptanceTester $I) } /** - * Test that restricting content by a Tag specified in the Page Settings works when - * creating and viewing a new WordPress Page and the subscriber uses a signed subscriber ID. + * Test that restricting content by a Tag specified in the Page Settings works when: + * - the Plugin is set to Require Login, + * - creating a viewing a new WordPress Page, + * - entering an email address displays the code verification screen + * - using a signed subscriber ID that has access to the Tag displays the content. * - * @since 2.7.1 + * @since 2.7.2 * * @param AcceptanceTester $I Tester. */ - public function testRestrictContentByTagUsingSignedSubscriberID(AcceptanceTester $I) + public function testRestrictContentByTagWithRequireLoginEnabled(AcceptanceTester $I) { + // Setup Restrict Content functionality with Require Login enabled. + $I->setupConvertKitPluginRestrictContent( + $I, + [ + 'require_tag_login' => 'on', + ] + ); + + // Add a Page using the Gutenberg editor. + $I->addGutenbergPage($I, 'page', 'Kit: Page: Restrict Content: Tag: Require Login'); + + // Configure metabox's Restrict Content setting = Tag name. + $I->configureMetaboxSettings( + $I, + 'wp-convertkit-meta-box', + [ + 'form' => [ 'select2', 'None' ], + 'restrict_content' => [ 'select2', $_ENV['CONVERTKIT_API_TAG_NAME'] ], + ] + ); + + // Add blocks. + $I->addGutenbergParagraphBlock($I, 'Visible content.'); + $I->addGutenbergBlock($I, 'More', 'more'); + $I->addGutenbergParagraphBlock($I, 'Member-only content.'); + + // Publish Page. + $url = $I->publishGutenbergPage($I); + + // Test Restrict Content functionality. + $I->testRestrictedContentByTagOnFrontendUsingSignedSubscriberID($I, $url, $I->generateEmailAddress()); + } + + /** + * Test that restricting content by a Tag specified in the Page Settings works when: + * - the Plugin is set to Require Login, + * - the Plugin has its Recaptcha settings defined, + * - creating a viewing a new WordPress Page, + * - entering an email address displays the code verification screen + * - using a signed subscriber ID that has access to the Tag displays the content. + * + * @since 2.7.2 + * + * @param AcceptanceTester $I Tester. + */ + public function testRestrictContentByTagWithRecaptchaAndRequireLoginEnabled(AcceptanceTester $I) + { + // Setup Restrict Content functionality with Require Login and reCAPTCHA enabled. + $I->setupConvertKitPluginRestrictContent( + $I, + [ + 'require_tag_login' => 'on', + 'recaptcha_site_key' => $_ENV['CONVERTKIT_API_RECAPTCHA_SITE_KEY'], + 'recaptcha_secret_key' => $_ENV['CONVERTKIT_API_RECAPTCHA_SECRET_KEY'], + 'recaptcha_minimum_score' => '0.01', // Set a low score to ensure reCAPTCHA passes the subscriber. + ] + ); + // Add a Page using the Gutenberg editor. - $I->addGutenbergPage($I, 'page', 'Kit: Page: Restrict Content: Tag by Signed Subscriber ID'); + $I->addGutenbergPage($I, 'page', 'Kit: Page: Restrict Content: Tag: Recaptcha and Require Login'); // Configure metabox's Restrict Content setting = Tag name. $I->configureMetaboxSettings( @@ -87,7 +148,7 @@ public function testRestrictContentByTagUsingSignedSubscriberID(AcceptanceTester $url = $I->publishGutenbergPage($I); // Test Restrict Content functionality. - $I->testRestrictedContentByTagOnFrontendUsingSignedSubscriberID($I, $url); + $I->testRestrictedContentByTagOnFrontendUsingSignedSubscriberID($I, $url, $I->generateEmailAddress(), false, true); } /** diff --git a/views/frontend/restrict-content/product-code.php b/views/frontend/restrict-content/code.php similarity index 100% rename from views/frontend/restrict-content/product-code.php rename to views/frontend/restrict-content/code.php diff --git a/views/frontend/restrict-content/header.php b/views/frontend/restrict-content/header.php new file mode 100644 index 000000000..3b038051b --- /dev/null +++ b/views/frontend/restrict-content/header.php @@ -0,0 +1,21 @@ + +

+

+ '; + } + ?> +

\ No newline at end of file diff --git a/views/frontend/restrict-content/product-email.php b/views/frontend/restrict-content/login-email.php similarity index 100% rename from views/frontend/restrict-content/product-email.php rename to views/frontend/restrict-content/login-email.php diff --git a/views/frontend/restrict-content/product-modal-content-code.php b/views/frontend/restrict-content/login-modal-content-code.php similarity index 100% rename from views/frontend/restrict-content/product-modal-content-code.php rename to views/frontend/restrict-content/login-modal-content-code.php diff --git a/views/frontend/restrict-content/product-modal-content-email.php b/views/frontend/restrict-content/login-modal-content-email.php similarity index 93% rename from views/frontend/restrict-content/product-modal-content-email.php rename to views/frontend/restrict-content/login-modal-content-email.php index 2771e1413..fa1e262ca 100644 --- a/views/frontend/restrict-content/product-modal-content-email.php +++ b/views/frontend/restrict-content/login-modal-content-email.php @@ -12,5 +12,5 @@ ?>

get_class( 'output_restrict_content' )->restrict_content_settings->get_by_key( 'email_heading' ) ); ?>

\ No newline at end of file diff --git a/views/frontend/restrict-content/product-modal.php b/views/frontend/restrict-content/login-modal.php similarity index 91% rename from views/frontend/restrict-content/product-modal.php rename to views/frontend/restrict-content/login-modal.php index 0d9465184..a2d0a7dd8 100644 --- a/views/frontend/restrict-content/product-modal.php +++ b/views/frontend/restrict-content/login-modal.php @@ -14,7 +14,7 @@
diff --git a/views/frontend/restrict-content/product.php b/views/frontend/restrict-content/product.php index d5819775d..052fd0679 100644 --- a/views/frontend/restrict-content/product.php +++ b/views/frontend/restrict-content/product.php @@ -1,9 +1,9 @@
-

restrict_content_settings->get_by_key( 'subscribe_heading' ) ); ?>

-

- restrict_content_settings->get_by_key( 'subscribe_text' ) ) as $text_line ) { - echo esc_html( $text_line ) . '
'; - } - ?> -

- settings->scripts_disabled() ) { @@ -31,7 +27,7 @@ restrict_content_settings->get_by_key( 'email_text' ) ); ?>

diff --git a/views/frontend/restrict-content/tag.php b/views/frontend/restrict-content/tag.php index 50fa02867..e4c5fd3d2 100644 --- a/views/frontend/restrict-content/tag.php +++ b/views/frontend/restrict-content/tag.php @@ -13,14 +13,9 @@
-

restrict_content_settings->get_by_key( 'subscribe_heading_tag' ) ); ?>

-

- restrict_content_settings->get_by_key( 'subscribe_text_tag' ) ) as $text_line ) { - echo esc_html( $text_line ) . '
'; - } - ?> -

+
@@ -48,6 +43,7 @@