I’ve had to modify my sign up process so that I can add in questionnaires before the user signs up and then save the result when the user account is made.
When I first had a google for this, there was literally nothing out there so I’m hoping this will be some use!
First off, what am I on about?
The sign up process is the process that the user is taken through when they click the ‘join here’ button on your login form. This will take them through a series of steps in order to create an account. However just finding the code which handles that process is confusing enough!
Everything is managed under the User module.
The files associated with the sign up process are as follows;
Your forms (using the Zend form builder)
Application > Modules > User > Form > Signup
Here you store your form classes (the classes which extend Engine_Form) for things like questionnaires/profile widgets etc
Sign up Step controllers
Application > Modules > User > Plugin > Signup
Each file here represents a step in the sign up process. Within each file there will be a few methods such as onSubmit, onProcess, onAdminProcess, onView. Within each of these methods you can perform an action e.g. form submission you can validate or save the form details to the database etc.
Each view for your Plugins (sign up steps)
Application > Modules > User > views > Signup > Form
Here you’ll add stuff that the user sees, so it’s your view for each one of the Sign up Step controllers (plugins above). It’l have to share the same name as it’s parent controller in the plugin directory.
Overlord / Main signup process controller
Application > Modules > User > Controllers > SignupController
You’re probably NOT going to want to edit this as it manages the whole process of what’s validated/comes next. The main bulk of your code will be in the plugins (above). However I did edit it so that I could save some session variables to the database once a user had been fully created.
Backend Database ordering
So this is all good and well that you can now add new steps in the sign up controller but how do you order these? If you navigate to the table engine4_user_signup you’ll see that there are rows which show what class is called and what order they are in. You can also disable and enable certain steps in the sign up process.
When creating a new step in the sign up process you have to make sure you add a row in this table and correctly order your step (without duplicate entries in the order list!) the ‘class’ field refers to the name of the class within Application > Modules > User > Plugin > Signup > You Controller Name.