• Resolved bestprogrammerintheworld

    (@bestprogrammerintheworld)


    Hello

    I want to bypass the “feature of WordPress” that returns an error when an email already exists.

    I’ve find code at WordPress Stackexchange:
    Skip email code

    I’ve tried to put this code in my themes function.php

    function skip_email_exist($user_email){
        define( 'WP_IMPORTING', 'SKIP_EMAIL_EXIST' );
        return $user_email;
    }
    add_filter('pre_user_email', 'skip_email_exist');

    but it does not work. I don’t know if I should use any other filter together with Profile Builder? Or is this just an impossible thing to do with never versions of WordPress? (3.7)

    http://ww.wp.xz.cn/plugins/profile-builder/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    can you tell me (exactly) what message you get when trying to register (import) a user with an existing email address?

    Also, where exactly do you need this? on the register page?

    keep me posted!

    Regards,
    Gabriel

    Thread Starter bestprogrammerintheworld

    (@bestprogrammerintheworld)

    Hi Gabriel!

    I know it’s not correct to duplicate emails, but I’m actually forced to because the same customer comes back to the registration form, adds an another name but the same email-adress and he she/she must be to do that.

    The exact message is:
    Sorry, that email address is already used! (taken from language file)

    I need it when a user submits a new user on the front-end-registration

    Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    I think you can do something like this:

    add_filter (‘wppb_register_useremail_error2’, ‘no_email_error’);
    function no_email_error($old_message){

    return ”; //return an empty string to give no error message
    }

    Add this to your currently active theme’s functions.php file, and it should work (in theory).
    Keep me posted!

    Gabriel

    Thread Starter bestprogrammerintheworld

    (@bestprogrammerintheworld)

    Hi. It almost worked 🙂 I don’t get any error now, but the registration process gets back to the front-end-registration-page:
    The forms submits, shows no errors (great!), but then goes back to the form again (and it does not create any user in the db and no email is sent).

    Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello,

    unfortunately I have no idea why happens in the background; surely WP has some things put into place to not create a user if a username/email is already in the database.

    I mean: can you do what you wish by using the default registration page? Or you can try to create a small script that registers a user on your site with an already existing email address; we use the following wp function in PB when creating a new user: http://codex.ww.wp.xz.cn/Function_Reference/wp_create_user

    Try to add it in a script, and see if that works or not.

    Keep me posted!
    Gabriel

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

The topic ‘Pre_user_email not working’ is closed to new replies.