This plugin allows you to make custom wizards for your forum. Custom wizards can provide information, take user input and perform actions based on that input.
You will automatically see an example of it in action when you sign up for a new account on my sandbox.
It builds on top of the Setup wizard in Discourse, abstracting various aspects of it into a configurable component or setting. The Discourse Setup wizard is its own Ember app. This plugin extends that app in various ways to make it customizable by admins via a new
Wizards route in the Discourse admin panel.
Custom Wizards can:
Display text or images in a structured format. Text can be taken from translation files or entered via the admin panel.
Take user input via text boxes, textareas, dropdowns, or radio buttons.
Perform actions based on user input. The actions currently available are:
Update user profile fields.
Create a new topic.
Create a new message.
Custom Wizards are each given a distinct url in the
/w/ namespace. You can automatically redirect users to wizards:
After they create an account, or accept an invite (e.g. an introduction to your community). If they have accepted an invite to a topic they will still be automatically redirected to that topic after they complete the wizard.
After a certain time (e.g. when you update terms and conditions). When the specified time is reached all users (including those currently logged in / active) will be redirected to the wizard.
Custom Wizards can be:
Single or multiple submission.
Required or optional.
There is also an option to turn off the functionality that saves user input to the db (but still allows it to be used in Actions), which may apply in special cases.
The configuration should be self explanatory, so I won’t attempt to describe it in detail here, but to give you a sense of what’s involved, this is what the configuration for Step 2 of the Welcome wizard that you see after signing up an account on my sandbox looks like.
The Wizard Step itself looks like this.
You can also add your own step handler logic from a separate plugin if you have custom logic you need to perform on user input when the user clicks “Next” or “Submit”.
CustomWizard::Builder.add_step_handler('wizard_id') do |builder| # your logic. end
You can see what is available via the builder object here.
You can also inject additional assets into custom wizards from a separate plugin. For example the Locations Plugin has these lines in its plugin.rb
if defined?(CustomWizard) == 'constant' && CustomWizard.class == Module CustomWizard::Field.add_assets('location', 'discourse-locations', ['components', 'helpers', 'lib', 'stylesheets']) end
And has a wizard-specific component in
location-form component so it can be used in a wizard.
The end result being the location form in Step 3 of the Welcome Wizard in my sandbox.
Any custom component can be added to a custom wizard in this fashion.
A note of caution. This is a complex plugin. I have tested it a fair bit, but there is a lot of functionality here and it will take a little while to iron it out. I suggest you use it for simple use cases at this stage.