Created
March 23, 2023 22:23
-
-
Save greenhornet79/025489b62a393c8fb819bbee104436c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add toc field to registration form | |
add_action('leaky_paywall_after_password_registration_field', 'zeen_custom_tos_registration_fields'); | |
function zeen_custom_tos_registration_fields() | |
{ | |
?> | |
<div class="form-row"> | |
<input style="display: inline;" type="checkbox" required id="tos" name="tos"> <label for="tos" style="display: inline;">I understand I will be automatically billed on my renewal date unless I cancel, and I agree to all <a target="_blank" href="<?php echo home_url('subscription-terms'); ?>">terms and conditions</a>.</label> | |
</div> | |
<?php | |
} | |
add_filter('leaky_paywall_account_setup_validation', 'zeen_validate_tos', 20, 2); | |
function zeen_validate_tos($errors, $fields) | |
{ | |
if (!isset($fields['tos'])) { | |
$errors['tos'] = array( | |
'message' => __('You must agree to the terms and conditions to continue.', 'leaky-paywall'), | |
); | |
} | |
return $errors; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment