• Resolved JohnX

    (@xbootenk)


    I have used your plugin for a couple of years, I’m happy with it and I recently made a donation.

    My WP user file has been corrupted with some users having the wrong email address assigned to their record. The username is also the email address and this is correct.

    I attempted to update the users with an import of two columns (username and user_email) from a CSV file. This works for those users whose emails are already correct but the update is rejected for those users with incorrect email addresses.

    Why is this and what can I do to correct this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Javier Carazo

    (@carazo)

    @xbootenk,

    Good afternoon, and thanks for using this plugin.

    The email check is some kind of security to prevent someone to change emails in an accidental way.

    It could be a good idea maybe to create an option to do it.

    What do you think about it?

    Thread Starter JohnX

    (@xbootenk)

    I would prefer an option that allows user_email to be changed from a CSV file.

    The alternative is to delete all users except an admin and reload the user records from CSV. Not too bad but less desirable.

    Thread Starter JohnX

    (@xbootenk)

    Can I get a response?

    My only other option is to delete all my members and reload them, forcing them to create new passwords.

    Plugin Author Javier Carazo

    (@carazo)

    Sorry, yesterday was our regional holiday and we were out of office.

    I can create a checkbox to allow users change the emails.

    Let me do it and I will include in next update.

    I will try to have it done asap.

    Plugin Author Javier Carazo

    (@carazo)

    John,

    I was wrong. In the code I did it:

    elseif( username_exists( $username ) ){ // if user exists, we take his ID by login, we will update his mail if it has changed
    						if( $update_existing_users == 'no' ){
    							continue;
    						}
    
    						$user_object = get_user_by( "login", $username );
    						$user_id = $user_object->ID;
    
    						if( $password !== "" )
    							wp_set_password( $password, $user_id );
    
    						if( !empty( $email ) ) {
    							$updateEmailArgs = array(
    								'ID'         => $user_id,
    								'user_email' => $email
    							);
    							wp_update_user( $updateEmailArgs );
    						}
    
    						$created = false;
    					}

    So:

    1. if user exists by their username
    2. and you are updating
    3. it updates their emails

    So if you upload a whole CSV with usernames (the good ones) as the reference to update, and emails corrected, all emails will be properly imported and updated.

    Did the execution ends?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unable to correct user_email’ is closed to new replies.