Check if Email already exist

Support MB User Profile Check if Email already existResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10808
    marcodedomarcodedo
    Participant

    Hi, I'm looking for ways to check if email already exists when a user sign in.
    I saw the documentation and found:
    do_action( 'rwmb_profile_before_save_user', $object );
    but I do not know how to use this action to make a check like this:

    $email = '[email protected]';
    $exists = email_exists( $email );
    if ( $exists ) {
        echo 'That E-mail is registered to user number ' . esc_html( $exists );
    } else {
        echo 'That E-mail doesn\'t belong to any registered users on this site';
    }
    #10816
    Anh TranAnh Tran
    Keymaster

    Hi,

    That action doesn't fire for login form, because the form doesn't need to create or update user info.

    The login form users WordPress's function wpsignon to log user in. And it auto checks the email address. I wonder the use case that you manually check for email exists. Is that really needed?

    #10826
    marcodedomarcodedo
    Participant

    I said that badly.
    I would like to do a check when a user registers in the form. This is why I identified this action:
    do_action( 'rwmb_profile_before_save_user', $object );
    but I do not know how to use this action to make a check like this:

    $email = '[email protected]';
    $exists = email_exists( $email );
    if ( $exists ) {
        echo 'That E-mail is registered to user number ' . esc_html( $exists );
    } else {
        echo 'That E-mail doesn\'t belong to any registered users on this site';
    }
    #10836
    Anh TranAnh Tran
    Keymaster

    Hi Marco,

    The case an email exists is checked by the plugin and it will return an error message "Your email already exists" if it fails. Currently, there's no filter to change that message.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.