-
Author
-
August 23, 2016 at 23:00 #133566hotloverspassionParticipant
Hi guys,
I have found a code to “add confirm email field in register page” and it works so I am sharing it here for others.
I was also wondering and would like to ask you whether you could implement the same into sweetdate register form and provide us with the code. I will completely understand if you won’t be able to help with this as it might take some time. But I am sure that everyone ( including myself ) will be very grateful as this is great prevention of not losing members due to mistyping their emails π
Thanks π
Here is the code to “add confirm email field in register page” I found. Copy and paste it into functions.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” class=”form_field” 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’);
August 24, 2016 at 14:23 #133654LauraModeratorHello, thanks for the code π It is a nice idea π
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happyΒ to help you π
August 24, 2016 at 18:11 #133698RaduModeratorHi,
Thanks you for providing this.
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionNovember 9, 2016 at 07:57 #143504hotloverspassionParticipantHi montecci01,
sorry to hear that. The code still works for me, just checked it.
Did you put the code into functions.php?
Hope you’ll be able to sort it out πNovember 9, 2016 at 18:34 #143586RaduModeratorPay atention to the quotes it possible to have wired quote there, try to replace manualy quotes
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
You must be logged in to reply to this topic.