This topic has 5 replies, 4 voices, and was last updated 8 years by Radu.

  • Author
  • #133566
     hotloverspassion
    Participant

    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’);

    #133654
     Laura
    Moderator

    Hello, 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 solution

    Laura 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 πŸ™‚

    #133698
     Radu
    Moderator

    Hi,

    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 solution
    #143437
     Roader
    Participant

    This code does not work for me. HTTP ERROR 500

    #143504
     hotloverspassion
    Participant

    Hi 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 πŸ™‚

    #143586
     Radu
    Moderator

    Pay 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
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?