Selector type populated via database field - or added to by the user dynamically

For the specific use case of prior companies users have worked at - we would (1) display the (CSV) company list in the custom user field on both the user profile and popup card, and (2) build a custom profile search page that will allow users to find others who might have worked at Company A or Company B.

For (1), I’m assuming we’ll get that for free - i.e. Discourse will just display the values for this custom field.

For (2), the plan here would be to create this new site page and have a simple search mechanism index across user profile fields, including the custom entries that the CWP has written into the customer user profile field.

Definitely open to your thoughts / ideas on this approach of course!

1 Like

Yes, if you map to the correct field in the wizard custom fields. The user fields created by the dashboard have structure like user_field_x(off the top of my head) which you’re aware of I believe.

1 Like

Ack; so hopefully that answers your question @fzngagan on resultant captured data usage, but lmk if you need more context of course.

1 Like

Thats all for now. The work is already on. I was just trying to understand the scope.

Hi @james
I’ve come across an issue. Create: doesn’t show up on the wizard if the typed tag doesn’t already exist. Working on that now.

Thanks for the update. Please let me know if you’d like help - I’d be happy to spin up a new developer Discourse instance on a VPS and test what you have in progress.

1 Like

Ok I have it working. Just one point. We will need to discuss internally on whether this should be a part of actual plugin or a separate plugin. I think I can give it to you for testing tomorrow hopefully.


I just pushed the code to item-chooser branch.
To test you need to do git clone -b item-chooser in you app.yml.


  1. Create a user field using /admin/customize/user_fields

  2. Now right click on the window and click inspect. Move to the network tab. Click on Back in the browser window and go to the User Fields menu again. You’ll see this.

    Note the id for your field.

  3. Now create a wizard and add the item chooser field. Important this here is, the label is used as the name of the item. So use a simple 1 word label for the field.

  4. In actions, select Update Profile. In advanced use the custom field and the field name as user_field_fieldid. The field id is to be taken from step 2.

How to put data

Open up your rails console and paste the following lines there.

PluginStore.set('wizard_item','companies', ["Apple", "Microsoft", "Google"])

Now when adding the field in the wizard, you’ll need to put the label as companies.

A bit complex setup. Let me know if you get stuck.

Currently, its not possible to add items on the fly. Let’s see if I can get it working in straightforward way.

1 Like

Awesome! Thanks so much @fzngagan - I’ll carve out some time later this evening to give it a go - looks promising :slight_smile:

1 Like

Hey @fzngagan - I think I’m very close to getting it working :wink:

Only issue is that the user-selected companies via the Wizard are not landing in the Custom User Field on the user profile.

I suspect it is because I’m not correctly referencing the Custom User Field in the Wizard configuration -or - there’s a step I’m missing to connect the wizard update mechanism to the Custom User Field.

Here are the steps I’ve taken -

[1] Added Custom User Field

[2] Fetched the New Custom User Field ID via Chrome Dev Console


:warning: The newly created Custom User Field ID value is 7

[3.1] Created a New Wizard - Settings

Note: restricted Permitted Group to a Group we set up for feature testing.

[3.2] Created a New Wizard - Steps

Not set any Advanced options.

[3.3] Created a New Wizard - Fields

Field Label is set to company, Type is set to Item Chooser.

[3.4] Created a New Wizard - Actions

Advanced Custom map created from company -> user_field_7.

:question: Do I have the User Field correctly formed? I’ve tried user_field_7, user_field7, and a couple of other random variants.

[4] Load list of Companies to the store

[1] pry(main)> PluginStore.get('wizard_item','company')
=> ["Apple", "Microsoft", "Google"]

:warning: Note I used company and not companies as per your instructions because my Label is company.

I also tried companies to be 100% sure - and it did not populate the selector in the wizard - as expected, so I’m assuming it should be company here for my setup.

[5] Test the new Wizard

The selector works and allows me to add companies.


After hitting ‘Done’ the wizard submits, but I don’t see the field get updated on my profile.


Happy to hop on a quick call if easier to debug together, so please let me know.

Thanks again for your efforts on this - really excited to get it up+running for our community!

Cheers, James

1 Like

This setting should look like this.

Ah, looks like that might have been it :blush: thanks!


Found a couple of minor bugs that I’m sure you’re aware of:

  • a comma is placed at the front of the Custom User Field value.

  • the wizard appends the Custom User Field with each use; I believe the wizard should write-over (completely) the existing Custom User Field values each time the user runs through the wizard.



Glad its working. I’ll take a look tomorrow.


Finally taking a look.


I checked and this requires product level changes. I’ll suggest you disable multiple submissions temporarily.

@james I’m looking at this one today. I’m trying to confirm whether this happens across all the user fields or not.

And it does indeed.

Hi @james, i digged deep into this and located the piece of code responsible for this behaviour. The underlying code is actually discourse code which we’re using. Look out for the resolution in a day or two max.


I’ve reported the issue to the team here.


Great, thanks for the update and sorry this proving to be a headache!

1 Like

Yeah, it was intense honestly but you’ve in a way uncovered a long standing issue in the discourse codebase which has bitten us a number of times. So Thanks :slight_smile:


We’ve moved this topic to #quick-jobs as it seemed a perfect fit here :slight_smile:
You can read more here About the Quick Jobs category

Looking forward to more quick (and not so quick :wink: ) jobs from you.