Skip to:
Content
Pages
Categories
Search
Top
Bottom

BuddyPress very imp – add "Confirm Email" in Registration


  • techguy123
    Participant

    @techguy123

    Hi! 🙂

    I have a question, which I believe is very important in the BuddyPress registration process.

    How do I add “Confirm Email” in the BuddyPress registration field? (and make sure it actually checks the Email field and matches, similar to the “Confirm Password” field) – see screenshot (it is the default registration for BuddyPress, however I can PM you the link if necessary)

    Thanks!!

Viewing 6 replies - 1 through 6 (of 6 total)

  • danbp
    Moderator

    @danbp

    This field is fully part of WP registration process. And WP doesn’t use “email confirmation”.
    But you can try Theme My Login if you absolutely want such feature.


    techguy123
    Participant

    @techguy123

    Hello, I’ve tried the plugin but it does not work. Please let me know of any other methods to do this, thanks!!


    danbp
    Moderator

    @danbp

    What does not work in that plugin ?
    There is an option: Require users to be approved or confirm e-mail address upon registration.

    It’s the only alternative actually on hand for what you want to do. Don’t forget that this is in addition to WP (see my previous answer). It is not part of WP actually.


    techguy123
    Participant

    @techguy123

    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');
    ;
    
    ?>
    

    danbp
    Moderator

    @danbp

    Plugin has its own support. You can ask, or search there.


    techguy123
    Participant

    @techguy123

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘BuddyPress very imp – add "Confirm Email" in Registration’ is closed to new replies.
Skip to toolbar