-1

This is a newbie follow-up question on the solution for how to use the same email address for multiple users presented here:

How to use same email for multiple users

My question: where do I add this code (file name and location in file)?

I know this is probably extremely obvious to someone with even a little experience with Wordpress development. Any direction / help would be most appreciated.

Thanks, Mike

  • I will repeat the note I posted on that referenced question: You need to be careful with this. If you got this working and if you are trying to use the same email for multiple distinct individuals then any one of those individuals would be able to reset the password for any or all of the accounts that use the shared email. That email address is part of the security system. – s_ha_dum Oct 6 '13 at 18:00
  • 1
    Please, the next time you have a doubt concerning an existing answer, instead of creating a new question, add a comment to the existing question. You need a reputation of 50 to be able to leave comments, alternatively you can ask in chat, it requires only 20 rep. – That Brazilian Guy Oct 6 '13 at 18:00
  • 1
    Agreed with @ThatBrazilianGuy : I do not see how this is a distinct question from the one you referenced. – s_ha_dum Oct 6 '13 at 18:02
  • Well, I think this is a distinct question because it's about how to implement the code and not what the code should be (see the answer below and how that's different from the answer in the original). – Mike Smith Oct 6 '13 at 18:37
2

As you assumed - the solution is pretty easy.

First create a file(for instance) skip-email-check.php and inside it put the code from the other answer:

add_filter('wpmu_validate_user_signup', 'skip_email_exist');
function skip_email_exist($result){
    if(isset($result['errors']->errors['user_email']) && ($key = array_search(__('Sorry, that email address is already used!'), $result['errors']->errors['user_email'])) !== false) {
        unset($result['errors']->errors['user_email'][$key]);
        if (empty($result['errors']->errors['user_email'])) unset($result['errors']->errors['user_email']);
    }
    define( 'WP_IMPORTING', 'SKIP_EMAIL_EXIST' );
    return $result;
}

Then save this file on your computer and upload it to the /wp-content/mu-plugins/ directory of your WordPress site. If the directory mu-plugins doesn't exist in the wp-content directory, simply create it and upload the file there.

This directory is for "must-use plugins" - meaning that any plugins(stand-along files, or plugin directories) found there will be automatically activated for all sites on a network and can not be deactivated, until they are removed from that directory. You can use this directory on a normal(single-install) WordPress and again any plugins you put there will be always activated.

Not the answer you're looking for? Browse other questions tagged or ask your own question.