WordPress and buddypress programming

Privacy Policy checkbox on registration page-without a plugin (simple)

Viewing 0 reply threads
  • Author
    Posts
    • #2251
      michael mc
      Keymaster
      @michael

      Add this to your themes fun file and it will display a agree-to-privacy-policy box on your Privacy Policy checkbox on registration page

      add_action( 'bp_before_registration_submit_buttons', function () { ?>
      	<div style="clear: both;">
      		<?php do_action( 'bp_privacy_policy_errors' ); ?>
      		<p>
      			<input type="checkbox" name="agree-to-privacy-policy" checked>
      			I agree with the <a href="<?php echo home_url( 'privacy' ); ?>">Privacy Policy</a>
      		</p>
      	</div>
      	<?php
      }, 11 );
      
      add_action( 'bp_signup_validate', function () {
      	global $bp;
        
      	if ( ! isset( $_POST['agree-to-privacy-policy'] ) || $_POST['agree-to-privacy-policy'] !== 'on' ) {
      	  $bp->signup->errors['privacy_policy'] = 'Please confirm that you agree with our privacy policy';
      	}
      } );
Viewing 0 reply threads
  • You must be logged in to reply to this topic.