Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Ulrich Sossou

    (@sorich87)

    How can I set the user role? whats the colunm name for that?

    The column name is ‘role’. Just put the role name (e.g. administrator, editor, contributor, and so on)

    How can I Update de User? Where do I specify the colunm to find for the update key?

    The column name is ‘ID’. Just put the ID of the existing user.

    Thread Starter raonip

    (@raonip)

    Hi! that’s great!! and quick answer!!

    It is possible to Update the user by the user LOGIN?
    If the user login is already in WordPress the details is updated?

    If not, is there a way I could change in the plugin?

    Thanks very much!!!

    Plugin Contributor Ulrich Sossou

    (@sorich87)

    It is possible to Update the user by the user LOGIN?
    If the user login is already in WordPress the details is updated?

    No, but I will definitely add that in the future version.

    If not, is there a way I could change in the plugin?

    Yes. Find all references of $userdata[‘ID’] in the plugin file import-users-from-csv.php and replace them by $userdata[‘user_login’].

    Thread Starter raonip

    (@raonip)

    Owwww!!! That’s PERFECT!!!

    Thanks very very much!!!!

    Plugin Contributor Ulrich Sossou

    (@sorich87)

    After some reflexion, I decided not to include that feature in the plugin.

    Here is a simple way to do that without modifying the plugin code: https://pubpoet.com/2011/05/28/update-users-import-users-csv/.

    Let me know if you have other questions or features requests.

    Thread Starter raonip

    (@raonip)

    Hi! Thanks very much for that!

    It is possible to have different header names in my CSV?
    If I change the names in the code below, it will work?

    $userdata_fields       = array(
    					'ID', 'user_login', 'user_pass',
    					'user_email', 'user_url', 'user_nicename',
    					'display_name', 'user_registered', 'first_name',
    					'last_name', 'nickname', 'description',
    					'rich_editing', 'comment_shortcuts', 'admin_color',
    					'use_ssl', 'show_admin_bar_front', 'show_admin_bar_admin',
    					'role'
    				);

    Sometimes is not possible to have the CSV exported with this header names….would be great if we could change the names, even inside the code…….do you think is possible?

    Thanks again!

    Thread Starter raonip

    (@raonip)

    hi, have a look at this plugin:
    https://www.ads-software.com/extend/plugins/csv-user-import/

    It has a code that maps each column name to the user data……

    I don’t know how to code that….just change somethings in PHP……maybe can help!!

    Thanks again!!

    Plugin Contributor Ulrich Sossou

    (@sorich87)

    Hi.

    I am not sure I understand what you want, the plugin you link to doesn’t use column names but positions.

    Do you want to be able to use e.g. “First Name” instead of “first_name”?

    If yes, you can do something like:

    add_filter( 'is_iu_import_userdata', 'example_filter_import_userdata', 10, 2 );
    
    function example_filter_import_userdata( $userdata, $usermeta ) {
    	if ( ! empty( $usermeta['First Name'] ) ) {
    		$userdata['first_name'] = $usermeta['First Name'];
    	}
    
    	return $userdata;
    }
    Thread Starter raonip

    (@raonip)

    Hi, that’s Exactly what I need!!!! Very nice!

    I have to put this code in my functions file, right?
    If I want to change many colunm names I just copy and paste this part changing the names?

    if ( ! empty( $usermeta['First Name'] ) ) {
    		$userdata['first_name'] = $usermeta['First Name'];
    	}

    I’m just confused…..I try to import a CSV other then your example and is not working…..
    Maybe is because I’m made the CSV in MAcC OS X Editor?
    Can I send you the file?
    The CSV needs to be with “,” or can be “;”?
    Also needs to be enclosed by ” “??

    Thread Starter raonip

    (@raonip)

    Hi!

    I have just tried and I could Import the CSV that I created in my Editor. Just have to turn UTF-8.

    I tried your code below in my functions file and is not working….should I put anywhere else?

    add_filter( 'is_iu_import_userdata', 'example_filter_import_userdata', 10, 2 );
    
    function example_filter_import_userdata( $userdata, $usermeta ) {
    	if ( ! empty( $usermeta['First Name'] ) ) {
    		$userdata['first_name'] = $usermeta['First Name'];
    	}
    
    	return $userdata;
    }

    I also changed in CSV file header from “first_name” to “First Name”…..

    Any clue?
    Thanks again for all your support!

    Plugin Contributor Ulrich Sossou

    (@sorich87)

    Strange. I just tried that and it works. Can you check again?

    The column name is ‘ID’. Just put the ID of the existing user.

    Hi Ulric, when I use the ID header, nothing gets imported, when I use user_id as a header, it does import the users but creates a different user id number to the one I need.

    Can you advise? I have to match these users to a bunch of posts that need to be imported that have a “profileid” field that must match with the user id

    Plugin Contributor Ulrich Sossou

    (@sorich87)

    @bazonline, try the latest version (0.3.1) . And next time, please open a new thread. Old ones are easily overlooked.

    Thanks Ulrich, will get latest version- and thanks for replying on Christmas day!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: Import Users from CSV] Questions’ is closed to new replies.