-
-
Save kimwhite/c45ea7e75191bd6cda50e00499e8f72d to your computer and use it in GitHub Desktop.
Additional TOS Page for Register Helper
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 | |
/** | |
* This recipe adds an additional Terms of Service Page for Register Helper | |
* applies formatting & shortcodes, uses post title for field label | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmprorh_tos_init() | |
{ | |
// Set additional Terms of Service post ID here. | |
$tos_page = 490; // change this to match the additional page you are wanting to add | |
$post = get_post($tos_page); | |
$content = apply_filters('the_content', $post->post_content); | |
$html = '<div id="pmpro_license">' . $content . '</div> | |
<input type="checkbox" name="custom_tos" value="1" id="custom_tos" /> <label class="pmpro_normal pmpro_clickable" for="custom_tos">I Agree</label> | |
'; | |
$fieldtos = new PMProRH_Field('custom_tos', 'html', array( | |
'html' => $html, | |
'label' => $post->post_title, | |
'required' => true, | |
'class' => 'custom_tos' | |
)); | |
//add field to checkout page | |
pmprorh_add_registration_field('before_submit_button', $fieldtos); | |
} | |
add_action('init', 'my_pmprorh_tos_init'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment