From 6d769a53926bf96d8d50f395daab9fd7ea4d541f Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 24 May 2018 15:32:51 +1000 Subject: [PATCH] If wizard is required add a redirect_to after signup --- lib/wizard_edits.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/wizard_edits.rb b/lib/wizard_edits.rb index fb768552..5e9f0b3e 100644 --- a/lib/wizard_edits.rb +++ b/lib/wizard_edits.rb @@ -10,7 +10,16 @@ require_dependency 'wizard/step' custom_redirect = nil if user && wizard_id = CustomWizard::Wizard.after_signup - custom_redirect = wizard_id.dasherize + custom_redirect = wizard_id + + wizard = CustomWizard::Wizard.new(user, id: wizard_id) + + data = PluginStore.get('custom_wizard', wizard_id) + + if data['required'] + user.custom_fields['redirect_to_wizard'] = wizard_id + user.save_custom_fields(true) + end if CustomWizard::Wizard.new(user, id: wizard_id).completed? custom_redirect = nil