Skip to content

Instantly share code, notes, and snippets.

@messica
Last active April 24, 2020 13:33
Show Gist options
  • Save messica/3f9a654d87c5282a3d2a to your computer and use it in GitHub Desktop.
Save messica/3f9a654d87c5282a3d2a to your computer and use it in GitHub Desktop.
Additional TOS Page example for Register Helper
<?php
/*
* Additional Terms of Service Page example for Register Helper
* applies formatting & shortcodes, uses post title for field label
*/
function my_pmprorh_init()
{
// Set additional Terms of Service post ID here.
$tos_page = 4;
$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>
';
$field = 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('checkout_boxes', $field);
}
add_action('init', 'my_pmprorh_init');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment