Hello,
I have a custom profile field for Privacy policy with the options (Accept) and (Reject)
1. When users select option (Accept policy) they can register successfully
2. But when user select the option (Reject policy) prevent user from registering and display error message (You are required to accept our privacy policy to complete registration)Hello Tosin,
Thank you for posting. BuddyPress does provide default functionality for privacy acceptance. It only checks a published privacy policy page. You can find Privacy Policy page settings under Settings > Privacy page in the dashboard. Please make sure your privacy page is published.
Please give it a try.
Regards
RaviHi Tosin,
If you are looking for code, It will be hardcoded to your field id.Please create a select field and share me the field id and the screenshot of the options(in the Edit Profile Field) section.
Regards
BrajeshHi tosin,
Please use the following code// forces user to select a specific select field value on registration page. add_action( 'bp_signup_validate', function () { $field_id = 4448; // Your select field id. $accepted_value = 'I accept'; // please change with the value you want to accept. if ( ! isset( $_POST[ 'field_' . $field_id ] ) ) { return; //should never happen if the field is marked as required. } $selected_val = $_POST[ 'field_' . $field_id ]; if ( strtolower( $accepted_value ) !== strtolower( $selected_val ) ) { buddypress()->signup->errors[ 'field_' . $field_id ] = __( 'This is a required field. You must accept.', 'buddypress' ); } } );
please make sure to update the variable $accepted_value with the actual value which you have used for your selectbox.
Regards
Brajesh
The topic ‘ [Resolved] Buddypress conditional registration’ is closed to new replies.