WordPress.org

Make WordPress Core

Changeset 10990


Ignore:
Timestamp:
04/17/2009 06:43:40 PM (9 years ago)
Author:
ryan
Message:

Enforce unique email addresses. Props Denis-de-Bernardy. fixes #9563

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/user.php

    r10975 r10990  
    168168    /* checking e-mail address */
    169169    if ( empty ( $user->user_email ) ) {
    170         $errors->add( 'user_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
    171     } else
    172         if (!is_email( $user->user_email ) ) {
    173             $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
    174         }
     170        $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
     171    } elseif (!is_email( $user->user_email ) ) {
     172        $errors->add( 'invalid_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) );
     173    } elseif ( ( $owner_id = email_exists($user->user_email) ) && $owner_id != $user->ID ) {
     174        $errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
     175    }
    175176
    176177    if ( $errors->get_error_codes() )
Note: See TracChangeset for help on using the changeset viewer.