Forum Replies Created
-
I mean for the code above (it’s not the plugin’s code), I was hoping that someone could identify why it doesn’t load on the first try on the registration page.
Hi, the thing is when I install the plugin, it messes up my login pages.
However, I’ve sort of managed to figure something out. The following code, when placed in bp-custom.php file, does exactly what I need it to do. Just ONE thing, is that it doesnt show the “Confirm Email” field during the first try. So when you click the “Complete signup” button, the page reloads and THEN it says confirm email field is missing. So on the second try, a user can successfully fill in all the fields and sign up. Would you know how to make this label “Confirm Field” show up when the page loads the first time? Thanks for your assistance, greatly appreciate it!! 😀
<?php function registration_add_email_confirm(){ ?> <?php do_action( 'bp_signup_email_first_errors' ); ?> <input type="text" name="signup_email_first" id="signup_email_first" value="<?php echo empty($_POST['signup_email_first'])?'':$_POST['signup_email_first']; ?>" /> <label>Confirm Email <?php _e( '(required)', 'buddypress' ); ?></label> <?php do_action( 'bp_signup_email_second_errors' ); ?> <?php } add_action('bp_signup_email_errors', 'registration_add_email_confirm',20); function registration_check_email_confirm(){ global $bp; //buddypress check error in signup_email that is the second field, so we unset that error if any and check both email fields unset($bp->signup->errors['signup_email']); //check if email address is correct and set an error message for the first field if any $account_details = bp_core_validate_user_signup( $_POST['signup_username'], $_POST['signup_email_first'] ); if ( !empty( $account_details['errors']->errors['user_email'] ) ) $bp->signup->errors['signup_email_first'] = $account_details['errors']->errors['user_email'][0]; //if first email field is not empty we check the second one if (!empty( $_POST['signup_email_first'] ) ){ //first field not empty and second field empty if(empty( $_POST['signup_email'] )) $bp->signup->errors['signup_email_second'] = 'Please make sure you enter your email twice'; //both fields not empty but differents elseif($_POST['signup_email'] != $_POST['signup_email_first'] ) $bp->signup->errors['signup_email_second'] = 'The emails you entered do not match.'; } } add_action('bp_signup_validate', 'registration_check_email_confirm'); ; ?>
Hello, I’ve tried the plugin but it does not work. Please let me know of any other methods to do this, thanks!!