• Resolved Malcolm

    (@malcolm-oph)


    An invalid EMail in the CSV file generates a user with no email address.

    It looks like wp_insert_user and wp_create_user functions both pass the email address through sanitize_email (via a default WP filer). This returns an empty string if the email is invalid, but the WP functions do not test the return value, so an empty email address is added to the user record.

    I fixed this by adding a code snippet to importer.php to block the adding/updating of a user entry that has an invalid email address.

    Before the following code (currently line 239):
    elseif(username_exists( $username ) ){ // if user exists, we take his ID)

    I added the following:

    elseif( !empty( $email ) && ((sanitize_email($email) == '')) ){ // if email is invalid
    	$problematic_row = true;
    	$data[0] = __('Invalid EMail','import-users-from-csv-with-meta')." ($email)";
    }
    • This topic was modified 6 years, 3 months ago by Malcolm.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Invalid EMail in CSV File generates blank entry’ is closed to new replies.