• Resolved fried_eggz

    (@fried_eggz)


    I have made a change to the plugin to allow in to import users with multiple roles. Using multiple roles for one users can be a good way of separating users.

    On line 313, replace the if statement with:

    // If no error, let's update the user meta too!
    if ( $usermeta ) {
    	foreach ( $usermeta as $metakey => $metavalue ) {
    		$metavalue = maybe_unserialize( $metavalue );
    		// Add aditional roles
    		if($metakey == "role2" || $metakey == "role3" || $metakey == "role4"|| $metakey == "role5"){
    			$u = new WP_User( $user_id );
    			$u->add_role( $metavalue );
    		}else{
    			update_user_meta( $user_id, $metakey, $metavalue );
    		}
    	}
    }

    This will allow you to add more role-columns to the .csv file, naming the “role2”, “role3”, etc, up to 5 (you can easily add more if you need).

    Hope someone finds this useful.

    http://wordpress.org/plugins/import-users-from-csv/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Import users with multiple roles’ is closed to new replies.