# Nieuwe accounts kunnen niet meer worden aangemaakt vanwege oude multi-select user field plugin

**URL:** https://meta.discourse.org/t/can-no-longer-create-new-accounts-due-to-old-multi-select-user-field-plugin/281700
**Category:** Support
**Created:** [10 oktober 2023 om 04:47 UTC](https://meta.discourse.org/t/can-no-longer-create-new-accounts-due-to-old-multi-select-user-field-plugin/281700 "2023-10-10T04:47:42Z")
**Posts on this page:** 1
**Showing post:** 15

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [10 oktober 2023 om 20:23 UTC](https://meta.discourse.org/t/can-no-longer-create-new-accounts-due-to-old-multi-select-user-field-plugin/281700/15 "2023-10-10T20:23:09Z")

</div>

He’s lucky that I’m just up the road 😉.

The data format was interesting - it was in two different forms which changed one day. They started out as:

```plaintext
this
that

```

And one day they suddenly changed to

```plaintext
this,that

```

I did some ugly spreadsheet wizardry to transform the data into how the new multiselect fields are (as above). Unfortunately, [the script](https://meta.discourse.org/t/csv-upload-for-bulk-user-custom-field-changes/218619/5) can’t (yet) handle multiselect. PR anyone?

Although I can workaround / hack it to do the job I reckon:

1st pass: all users with a single entry using the existing script  
2nd pass: all users with multiple entries using a hacked script which forces new rows.

_later…_  
My cunning plan worked.

This is the hacked script for the 2nd pass:

```plaintext
# frozen_string_literal: true

require "csv"
desc "Import user fields"
task "multi_user_fields:import_csv", [:filename] => [:environment] do |_, args|

  puts "Filename: #{args[:filename]}"
  data = CSV.read(args[:filename], headers: true );

  data.each_entry do |row|
    puts "doing row."
    row.to_h.each do |x|
      user_id = row['user_id']
      if x.first == 'user_id'
        u = User.find(user_id)
        puts "Got user: #{u.username}"
      else
        name = x.first
        val = row[x.first]
        ucf = UserCustomField.find_by(user_id: row['user_id'], name: name)
          if val
            puts "Creating UCF: #{row['user_id']} Name: #{name}, value: #{val}"
            UserCustomField.create(user_id: user_id, name: name, value: val)
          end
      end
    end
  end
end

```

@pfaffman - how easy would it be to update the actual script to handle multi-select fields for others who mess with UCFs in the future?

---

_[View the full topic](https://meta.discourse.org/t/can-no-longer-create-new-accounts-due-to-old-multi-select-user-field-plugin/281700)._
