diff --git a/src/bp-members/bp-members-template.php b/src/bp-members/bp-members-template.php
index 81cf94075..9797bd5f8 100644
a
|
b
|
function bp_signup_avatar_dir_value() { |
2409 | 2409 | return apply_filters( 'bp_get_signup_avatar_dir_value', $signup_avatar_dir ); |
2410 | 2410 | } |
2411 | 2411 | |
| 2412 | /** |
| 2413 | * Determines whether privacy policy acceptance is required for registration. |
| 2414 | * |
| 2415 | * @since 4.0.0 |
| 2416 | * |
| 2417 | * @return bool |
| 2418 | */ |
| 2419 | function bp_signup_requires_privacy_policy_acceptance() { |
| 2420 | // Default to true when a published Privacy Policy page exists. |
| 2421 | $privacy_policy_url = get_privacy_policy_url(); |
| 2422 | $required = ! empty( $privacy_policy_url ); |
| 2423 | |
| 2424 | /** |
| 2425 | * Filters whether privacy policy acceptance is required for registration. |
| 2426 | * |
| 2427 | * @since 4.0.0 |
| 2428 | * |
| 2429 | * @param bool $required Whether privacy policy acceptance is required. |
| 2430 | */ |
| 2431 | return (bool) apply_filters( 'bp_signup_requires_privacy_policy_acceptance', $required ); |
| 2432 | } |
| 2433 | |
2412 | 2434 | /** |
2413 | 2435 | * Output the current signup step. |
2414 | 2436 | * |
diff --git a/src/bp-members/screens/register.php b/src/bp-members/screens/register.php
index fd92a63cd..8341f5266 100644
a
|
b
|
function bp_core_screen_signup() { |
73 | 73 | if ( ( !empty( $_POST['signup_password'] ) && !empty( $_POST['signup_password_confirm'] ) ) && $_POST['signup_password'] != $_POST['signup_password_confirm'] ) |
74 | 74 | $bp->signup->errors['signup_password'] = __( 'The passwords you entered do not match.', 'buddypress' ); |
75 | 75 | |
| 76 | if ( bp_signup_requires_privacy_policy_acceptance() && ! empty( $_POST['signup-privacy-policy-check'] ) && empty( $_POST['signup-privacy-policy-accept'] ) ) { |
| 77 | $bp->signup->errors['signup_privacy_policy'] = __( 'You must indicate that you have read and agreed to the Privacy Policy.', 'buddypress' ); |
| 78 | } |
| 79 | |
76 | 80 | $bp->signup->username = $_POST['signup_username']; |
77 | 81 | $bp->signup->email = $_POST['signup_email']; |
78 | 82 | |
diff --git a/src/bp-templates/bp-nouveau/buddypress/members/register.php b/src/bp-templates/bp-nouveau/buddypress/members/register.php
index 6eeb8629f..7647859f8 100644
a
|
b
|
|
104 | 104 | |
105 | 105 | </div><!-- //.layout-wrap --> |
106 | 106 | |
| 107 | <?php if ( bp_signup_requires_privacy_policy_acceptance() ) : ?> |
| 108 | <?php bp_nouveau_signup_privacy_policy_acceptance_section(); ?> |
| 109 | <?php endif; ?> |
| 110 | |
107 | 111 | <?php bp_nouveau_submit_button( 'register' ); ?> |
108 | 112 | |
109 | 113 | <?php endif; // request-details signup step ?> |
diff --git a/src/bp-templates/bp-nouveau/includes/template-tags.php b/src/bp-templates/bp-nouveau/includes/template-tags.php
index ce2ad93f5..0dd7c8c34 100644
a
|
b
|
function bp_nouveau_signup_form( $section = 'account_details' ) { |
2398 | 2398 | do_action( "bp_{$section}_fields" ); |
2399 | 2399 | } |
2400 | 2400 | |
| 2401 | /** |
| 2402 | * Outputs the Privacy Policy acceptance area on the registration page. |
| 2403 | * |
| 2404 | * @since 4.0.0 |
| 2405 | */ |
| 2406 | function bp_nouveau_signup_privacy_policy_acceptance_section() { |
| 2407 | $error = buddypress()->signup->errors['signup_privacy_policy']; |
| 2408 | |
| 2409 | ?> |
| 2410 | |
| 2411 | <div class="privacy-policy-accept"> |
| 2412 | <?php if ( $error ) : ?> |
| 2413 | <?php nouveau_error_template( $error ); ?> |
| 2414 | <?php endif; ?> |
| 2415 | |
| 2416 | <label> |
| 2417 | <input type="hidden" name="signup-privacy-policy-check" value="1" /> |
| 2418 | |
| 2419 | <?php /* translators: link to Privacy Policy */ ?> |
| 2420 | <input type="checkbox" name="signup-privacy-policy-accept" id="signup-privacy-policy-accept" required /> <?php printf( esc_html__( 'I have read and agree to this site\'s %s.', 'buddypress' ), sprintf( '<a href="%s">%s</a>', esc_url( get_privacy_policy_url() ), esc_html__( 'Privacy Policy', 'buddypress' ) ) ); ?> |
| 2421 | </label> |
| 2422 | </div> |
| 2423 | |
| 2424 | <?php |
| 2425 | } |
| 2426 | |
2401 | 2427 | /** |
2402 | 2428 | * Output a submit button and the nonce for the requested action. |
2403 | 2429 | * |