Custom Wizard Plugin

(Makary Gołosz) #41

I’d love to and I intend to, but I’d like to poke around the plugin and understand it fully first :slight_smile:

(Angus McLeod) #42

In other news, I’ve added a post builder for the Create Topic and Send Message actions. You can interpolate any wizard input and various user fields.

Use w{field_name} to interpolate a wizard field and u{attribute} to interpolate an attribute from the wizard user. The available fields and attributes appear above the builder editor for convenience.

For an example, see the Welcome wizard after signup on my sandbox. The configuration for the Create Topic action for the Welcome wizard on my sandbox now looks like this.

Example result:

cc @ransim @ploxnix

(David Taylor) #43

As far as I know the issues I had with translation fallbacks were fixed in February. It is possible it has regressed though - it’s not something I use on my own forum.


Thank you very much for this. Do you take donations or is there any other way to contribute (german translation maybe)?

(Anton) #45

Hi there, thanks for this plugin. Is this kind of your take on Feature request: workflows?

Quick question: can a wizard replace the “create a new topic” functionality in a particular category, configured per category? So that a new topics can be created through wizard only.

Useful for advertising categories, publications review categories, and so on.

(Angus McLeod) #46

It’s similar insofar as it allows the creation of topics and messages, and the updating of user properties, via a method other than the existing methods in the UI. However, it’s different in the sense that it’s driven by user input rather than by automated processes triggered by conditions.

The closer comparators are the form builder plugins you see in Wordpress (e.g. Gravity Forms). However, there are differences there too.

Yes, you could set this up if you wanted. Using the plugin api, you would modify the class (i.e. modifyClass) to override the createTopic methods in the discovery, discoveryCategories and tagsShow routes, redirecting the user to your wizard instead of opening the composer. You would also need to override the createTopic method in keyboard-shortcuts in a pre-initializer, so a user couldn’t open the composer using a shortcut.

(Anton) #47

What about making it a setting :blush:

So that I just tick a checkbox in category setting and choose a wizard in a dropdown box, and whenever someone clicks on the New Topic in that category, wizard opens.

(DaveK) #48

This looks like an awesome plugin. I hope to see the ability to launch different wizards on different categories on create new topic! BTW, is the background image required? Can it just be a semi-transparent overlay?

(Angus McLeod) #49

The ‘Background’ setting of a custom wizard takes any string and applies it as the value for the background css property of the wizard container. So you can have any background you want. e.g.

However, if by ‘semi-transparent overlay’ you mean that you’re hoping to see the Discourse app underneath the wizard, like a modal, then unfortunately that is not possible.

The custom wizard, like the Discourse setup wizard, is a completely separate ember client app. When you’re using a wizard the Discourse ember app is not loaded at all. It can’t be overlaid on top of the Discourse UI. And you wouldn’t want it to be either; performance wise it would suffer.

(Makary Gołosz) #50

Hey @angus! I’ve played a bit with the plugin, it’s absolutely fantastic!
I wonder though about 2 things:

  • would it be possible to add another action? I have in mind one that would change user’s tracking status for topics/categories based on their input in the form;

I see many potential use-cases, but unfortunately I’m not much of a programmer, so I won’t be able to provide such plugin myself. What do you think about this feature?

  • could we get some more control over the wizard’s appearance? I. e. custom CSS?

Once again, thanks for brilliant work!

(Angus McLeod) #51

Could explain what you mean a bit more? Are you thinking the user is choosing their tracking status from a list or based on their stated interests, their tracking status of certain topics or categories changes?

I’ve added basic CSS theme support to Custom Wizards.

What I mean by ‘basic’ is:

  1. You can select a theme from your existing list of themes for each Wizard:

  2. Any CSS you’ve added yourself in that theme will be loaded for that particular wizard.

For example, on my sandbox, I created a new theme called ‘Welcome Wizard’ and added this CSS in Edit CSS/HTML > CSS.

.wizard-column .wizard-btn.primary {
    background-color: #9477cb;
    &:hover {
        background-color: #b19cd9;

I’ve selected that theme in the ‘Theme’ setting for the ‘Welcome Wizard’

Now the buttons in my sandbox Welcome Wizard are purple (and light purple when you hover):

Screenshot at Dec 17 12-32-19

The color variables used by a theme are not loaded, i.e. if you select the ‘Dark’ theme this does not mean your wizard will be dark by default. If you want it to be dark, you need to add CSS for the classes you want to be dark in theme CSS.

Ideally the theme color variables would work just like they do in normal Discourse, however this will take a bit more work. Having custom CSS for each theme, editable in the admin panel is enough for now.

(Makary Gołosz) #52

Wow, splendid!
I meant rather 2nd option - i. e. in ‘welcome’ wizard we could present users with list of topics/categories/tags, and they would automatically follow them. (Or perhaps also mute? Could be usefull in some cases!)

(Michał Frąckiewicz) #54

Is there a way to update custom profile field?
I want to write date when user accepts new privacy policy via wizard.
As a result I need something like this:

(Frederik) #55

Wauw I see this plugin. I have this issue: Import data from e.g Amazon like ISBN etc

Can I use this plugin to do that?

Im not sure I understand the features of this plugin…

(Angus McLeod) #56

Do you want the user to input the data, i.e. title, author, etc, or do you want to draw the data from amazon?

(Frederik) #57

Well, to draw the data automaticly from amazon - like I descripe in this topic.

(Angus McLeod) #58

If you want to draw it automatically, then this plugin is not what you’re after.

From what you’re saying in that other topic, it seems you’re looking at some kind of extended onebox.

(Frederik) #59

Thanks for the reply!

(Michał Frąckiewicz) #60

@angus Can you please see my earlier post? I feel like a ghost :ghost:

(Angus McLeod) #61

Sorry! I overlooked your post.

I’ve added user custom field support (and made some other minor tweaks).

Note that this means you can save a value input in a wizard field to a user custom field. There are two ways you could do this (the second of which was possible prior to the changes I just made):

  1. Use the created_at or updated_at timestamp on the UserCustomField saved by a wizard action. If all you need is a record, then this will work fine. You can query the db in the admin UI with the Data Explorer plugin.

  2. Use the submitted_at timestamp on the user’s wizard submission, which is available in the Admin UI at admin/wizards/submissions/:wizard_id if you have ‘Save wizard submissions’ option on.

I’ve tested your scenario on my sandbox and it works fine. Ideally, you need a staging instance where you can test to your own satisfaction as well, particularly with a action that affects every user like this one.