In this tip we're going to learn how to customize BuddyPress registration page. We'll add a Terms and conditions box in the registration page.
0. Install the WPLMS Customizer plugin
1. Go to WP Admin -> Plugins -> Editor -> WPLMS Customizer -> customizer_class.php
2. Paste the below code in the _construct function:
PHP Code:
add_action('bp_signup_validate', array($this,'custom_field_check_validation')); add_action('bp_before_registration_submit_buttons', array($this,'show_custom_field'),1,1);
PHP Code:
4. Go to Location WP Admin -> Plugins -> Editor -> WPLMS Customizer -> custom.css
5. Add the below code to style the Terms and conditions in the registration page :
function custom_field_check_validation(){ global $bp; $custom_field = $_POST['custom_field']; if (empty($custom_field) || $custom_field == '') { $bp->signup->errors['custom_field'] = __('Please Check Terms & Conditions','vibe'); } return; } function show_custom_field(){ echo '<div class="custom_field_container"> <h3><strong>'.__('Terms and Conditions','vibe').'</strong></h3> <div class="terms-and-conditions-container"> '.__('<Strong>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</strong> Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.','vibe').' </div>'; do_action( 'bp_custom_field_errors' ); echo '<input type="checkbox" name="custom_field" id="bph_field" value="1" /> <strong>'.__(' I agree to these Terms and Conditions').'</strong> </div>'; }
Change the terms and conditions code above.
4. Go to Location WP Admin -> Plugins -> Editor -> WPLMS Customizer -> custom.css
5. Add the below code to style the Terms and conditions in the registration page :
Code:
.custom_field_container{ clear:both; margin:20px 0; } .terms-and-conditions-container{ width:100%; margin:10px 0; border:1px solid #EFEFEF; height:120px; padding:10px; overflow-y:scroll; }
Check the screenshot :
Full source code of customizer_class.php : https://gist.github.com/MrVibe/5fc5e9ee405284b0caeb