• Resolved sternhagel

    (@sternhagel)


    Hello,
    first of all, thanks for this awesome plugin! It saved me a lot of time importing user data.

    However, there’s a feature I was missing, so I added it myself, and I’d kindly ask you if you might add this feature in a future version of the plugin.

    I had the task of updating a huge list of already existing WP users with new meta fields. The problem was, I didn’t have the option of re-importing the eMail address because the users might have changed it in the meantime, and I couldn’t risk overwriting any changes the users made.
    I tried omitting the eMail address in the imported CSV, but then the eMail address was deleted.

    In the documentation it’s clearly stated that the “Email” column is mandatory, so I can’t really say this is a bug – BTW, if you import a CSV with empty “Email” column, in addition to deleting the eMail field, all the affected users will get the standard WordPress “eMail-address-has-changed” eMail, even when you’ve switched this off in the mail options. This was a really bad bug for me, because it sent out an irritating eMail to about 1000 users, so it might be a good idea to catch this somehow.
    Anyway, I didn’t understand why the Email column had to be mandatory, so I hacked your plugin just a little bit, to add the option of leaving the “Email” field empty without deleting the existing eMail address – like you already did with the “password” field.

    These are my changes to importer.php – just added two “if” statements, same for lines 165 and 206:

    if( !empty( $email ) ) {
      $updateEmailArgs = array(
        'ID'         => $user_id,
        'user_email' => $email
      );
      wp_update_user( $updateEmailArgs );
    }

    With this code, if the eMail column is empty, the existing eMail address won’t be changed or deleted – which was necessary for my task, and it might be helpful for other users as well.

    Would you consider adding this to the next version of the plugin? I’d appreciate it very much.

    Best regards!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Allow updating of users without re-importing eMail address’ is closed to new replies.