Discourse-user-field-prompt

This theme component allows to show a user field form in any Discourse post. Changes made in the form will be saved in the current user profile. It’s useful to ask users to make change to a user field without having to force them to search the field in their profile.

Usage for a user field named age and another one named best fruits:

[wrap=user-field names="age,best fruits"][/wrap]

Install this theme component

16 Likes

Excellent addition. Thank you. @joffreyjaffeux

1 Like

Is there a minimum version for this?

I’ve installed and tried this but it doesn’t display my custom user fields. Can you see anything wrong with this block?

[wrap=user-field names="Job Title,Employer"][/wrap]
1 Like

Can you show me your user fields page please ?

1 Like

Ok it does work for me:

[wrap=user-field names="Job Title,Employer"][/wrap]

Two things:

  • first I added some debugging in the code, so if you pull the latest version of the theme, and open the console while looking at a code, if it can’t find a field it should show something like this:
Couldn’t find "Foo" in user fields: "Job Title", "Employer"
  • be sure to do a hard refresh of your page or the user fields won’t be available on the front. One thing you can do to be sure they are loaded is to open the console and look at the result from: Discourse.Site.currentProp("user_fields")

Also yes there’s a minimum version, I will lower it because I actually don’t use anything fancy. Will go to latest stable plugin api.

Done, plugin api required is now: 0.11.1 (as stable) before it was 0.11.2

1 Like

That change the the login API version has fixed it for me. Thank you @joffreyjaffeux :pray:

1 Like