﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
14834,wp_insert_user errors for users without e-mail addresses,clifgriffin,,"Greetings,
In versions previous to WP3, it was possible to pass wp_insert_user an array with or without an e-mail address and the user was created without issue. 

In WP3, a check was added to determine whether or not the user already exists by their e-mail address. 
{{{
if ( !$update && ! defined( 'WP_IMPORTING' ) && email_exists($user_email) )
          return new WP_Error('existing_user_email', __('This email address is already registered.') );
}}}

The problem with this check is that it matches the admin account if you pass it a null or blank e-mail address.  The admin account, being created by the installation script, does not start with an e-mail address. 

This has caused one of my plugins (Simple LDAP Login) to fail. To fix this, I had to do this:
{{{
if ( !function_exists('get_user_by_email') ) :
/**
 * Retrieve user info by email.
 *
 * @since 2.5
 *
 * @param string $email User's email address
 * @return bool|object False on failure, User DB row object
 */
function get_user_by_email($email) {
	if(strlen($email) == 0 || empty($email) || $email == """" || strpos($email, ""@"") == false)
	{
		return false;
	}
	else
	{
		return get_user_by('email', $email);
	}
}
endif;
}}}

Please consider changing this behavior in future versions. I hate having to modify core functions to keep a plugin working. :)

  ",defect (bug),closed,normal,3.3,Users,3.0,normal,fixed,has-patch reporter-feedback,Jeremy Malcolm
