Custom Fields
Re-Envisioned
Support MB User Profile Check if Email already exist

  • Creator
    Topic
  • #10808
    Resolved marcodedo
    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 = 'myemail@example.com';
    $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';
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #10816
    Anh 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
    marcodedo
    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 = 'myemail@example.com';
    $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 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 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.