Support » Plugin: Import and export users and customers » Users without an email address are imported

  • Resolved ezimmerman9

    (@ezimmerman9)


    Hi. I’m working on a project where I’m importing lots of users from a csv file. Its a large file and some users don’t have email addresses. I’ve had to do several re-imports and I remember that it used to not add in users who didn’t have an email address but now it is adding them in. It shouldn’t import users if they don’t have an email address.

    I was worried some of my custom code was interfering so I created a fresh wordpress site and tried the import there and ran into the same problem. So its not a conflict with some code I’ve written.

    • This topic was modified 2 months, 1 week ago by ezimmerman9.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Javier Carazo

    (@carazo)

    Email is required importing:

    elseif( empty( $email) ) {
                                $errors[] = $acui_helper->new_error( $row, __( 'Email not specified', 'import-users-from-csv-with-meta' ) );     
                                $data[0] = __( 'EMail not specified', 'import-users-from-csv-with-meta' );
                            }

    Check your CSV, how are you editing it? Please use LibreOffice Calc this is the best option.

    Thread Starter ezimmerman9

    (@ezimmerman9)

    I indeed used libreoffice calc. The code within that elseif statement just seems to log an error and not break out of any loop. Shouldn’t it stop processing this row and move onto the next one when the email isn’t specified?

    Have you tried testing this yourself. I created a very basic test csv, here it is below:

    username,email,last_name,first_name
    user00,,lastname0,firstName0
    user01,mytestemail00123@testemail12345.com,lastName1,firstName1
    
    

    When I import using this csv, both users here are imported even though user00 has no email address.

    Thread Starter ezimmerman9

    (@ezimmerman9)

    I just tested adding a continue; statement at the end of the code within that elseif you mentioned and it no longer adds the users without an email address.

    elseif( empty( $email) ) {
                                $errors[] = $acui_helper->new_error( $row, __( 'Email not specified', 'import-users-from-csv-with-meta' ) );     
                                $data[0] = __( 'EMail not specified', 'import-users-from-csv-with-meta' );
                                continue;
                            }
    
    Plugin Author Javier Carazo

    (@carazo)

    @ezimmerman9,

    Sorry I forgot this email.

    I am going to fix it. Thanks for your suggestion.

    Plugin Author Javier Carazo

    (@carazo)

    Did it! Solved this with other issues.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.