Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter AiratVibe

    (@airathalitov)

    Or you can add small disclaimer (like “By registering, you agree to our Terms and confirm that you have read our Privacy Policy“).

    Plugin Author Shea Bunge

    (@bungeshea)

    I can certainly appreciate why this might be useful, but it seems a little different from what this plugin is attempting to do. Perhaps you could acheive the same result with a simple code snippet?

    For example, here’s an easy way to add some disclaimer text to the registration form:

    add_action( 'bp_before_registration_submit_buttons', function () { ?>
      
      <p style="clear: both">
      	By registering, you agree to our <a href="<?php echo home_url( 'terms' ); ?>">Terms</a>
      	and confirm that you have read our <a href="<?php echo home_url( 'privacy' ); ?>">Privacy Policy</a>.
      </p>
      
    <?php }, 11 );

    The advantage of using a snippet instead of having a feature in the plugin is that it is very easy to modify the text or appearance whenever you need to.

    Adding a checkbox requires a little extra code to validate that it was checked and display an error if not:

    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 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Privacy Policy checkbox on registration page’ is closed to new replies.