Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created March 23, 2023 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenhornet79/025489b62a393c8fb819bbee104436c8 to your computer and use it in GitHub Desktop.
Save greenhornet79/025489b62a393c8fb819bbee104436c8 to your computer and use it in GitHub Desktop.
<?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