bp_signup_check_email_username()

for check email id exist or not on ajax submit.

Description

Source

File: bp-members/screens/register.php

333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
function bp_signup_check_email_username() {
 
    $signup_username = '';
    $signup_email    = '';
    $account_details = bp_core_validate_user_signup( bp_get_signup_username_value(), bp_get_signup_email_value() );
    $email_opt       = function_exists( 'bp_register_confirm_email' ) && true === bp_register_confirm_email() ? true : false;
    $password_opt    = function_exists( 'bp_register_confirm_password' ) && true === bp_register_confirm_password() ? true : false;
    // If there are errors with account details, set them for display.
    if ( ! empty( $account_details['errors']->errors['user_name'] ) ) {
        $signup_username = $account_details['errors']->errors['user_name'][0];
    }
 
    if ( ! empty( $account_details['errors']->errors['user_email'] ) ) {
        $signup_email = $account_details['errors']->errors['user_email'][0];
    }
    // if email opt enabled.
    if ( true === $email_opt ) {
 
        // Check that both password fields are filled in.
        if ( empty( $_POST['signup_email'] ) || empty( $_POST['signup_email_confirm'] ) ) {
            $signup_email = __( 'Please make sure to enter your email twice.', 'buddyboss' );
        }
 
        // Check that the passwords match.
        if ( ( ! empty( $_POST['signup_email'] ) && ! empty( $_POST['signup_email_confirm'] ) ) && $_POST['signup_email'] != $_POST['signup_email_confirm'] ) {
            $signup_email = __( 'The emails entered do not match.', 'buddyboss' );
        }
    }
    $nickname_field = 'field_' . bp_xprofile_nickname_field_id();
    $return         = array(
        'field_id'        => bp_xprofile_nickname_field_id(),
        'signup_email'    => $signup_email,
        'signup_username' => $signup_username,
 
    );
 
    wp_send_json( $return, true );
}

Changelog

Changelog
Version Description
BuddyBoss 1.2.1 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.