Changeset 3507

Show
Ignore:
Timestamp:
02/09/06 08:11:26 (3 years ago)
Author:
matt
Message:

Better email error checking, fixes #2046

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/registration-functions.php

    r3481 r3507  
    99 
    1010    return null; 
     11} 
     12 
     13function email_exists( $email ) { 
     14    global $wpdb; 
     15    $email = addslashes( $email ); 
     16    $email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$email'"); 
     17    if ( $email_exists) 
     18        return true; 
    1119} 
    1220 
  • trunk/wp-register.php

    r3481 r3507  
    3434        $errors['user_login'] = __('<strong>ERROR</strong>: This username is already registered, please choose another one.'); 
    3535 
    36     /* checking the email isn't already used by another user */ 
    37     $email_exists = $wpdb->get_row("SELECT user_email FROM $wpdb->users WHERE user_email = '$user_email'"); 
    38     if ( $email_exists) 
    39         die (__('<strong>ERROR</strong>: This email address is already registered, please supply another.')); 
     36    if ( email_exists( $user_email ) ) 
     37        $errors['user_email'] = __('<strong>ERROR</strong>: This email is already registered, please choose another one.'); 
    4038 
    4139    if ( 0 == count($errors) ) { 
     
    5048     
    5149    if ( 0 == count($errors) ) { 
    52              
     50 
    5351    ?> 
    5452<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    102100<?php if ( isset($errors) ) : ?> 
    103101<div class="error"> 
    104     <ul
     102    <p
    105103    <?php 
    106     foreach($errors as $error) echo "<li>$error</li>"; 
     104    foreach($errors as $error) echo "$error<br />"; 
    107105    ?> 
    108     </ul
     106    </p
    109107</div> 
    110108<?php endif; ?>