[Resolved] How to create signup questionnaire before asking for email with user form?
This thread is resolved. Here is a description of the problem and solution.
Problem:
The user would like to offer a questionnaire or poll for visitors and create a user afterward. This may involve the possibility to change the username at the end.
Solution:
WordPress does not have a supported way of changing the email and the username. Especially the username. For that matter, some plugins have filled this gap, such as:
I want to use a multi-step signup questionnaire before asking for the user's email address.
Here is the scenario.
1) Logged out user goes to the homepage and clicks on get started
2) Logged out user is taken on a page with 1st page of the form that requires the user to share their target role
3) Once a user submits, the user is directed to the page that requires the target industry
4) the same process repeats for target seniority and job prefefence.
5) Once, all four steps are done, the user is asked to provide their email address.
6) Once that happens, the user is directed to the main dashboard.
Right now, I have steps 2 to 6 happening AFTER the user has been created by providing the usual registration info. But, I want to remove this hurdle and show the user more of the product before they have to sign up and provide personal info.
How can I accomplish this?
Right now, I have 4 separate CRED forms for each step. Should I create a dummy user in step one (without email and by using autogenerate functionality) and then update that user in steps 2,3,4. After that, should I add the email address to the same user?
Will this work?
Later on, I want to change the first name, last, and even username based on user preference. Can that be done?
I'm not sure that using CRED forms for this is a viable solution.
You have been able to get it to work thus far because the user is logged in after the first step, and so subsequent forms can make edits to their user profile.
If you move the registration step to the end and the users are editing a dummy profile, you need the users to log in with that dummy profile to be able to edit it. Guest users (not logged in) cannot edit some other profile (and without them being logged in and editing their own profile you would need some way of tracking which dummy user profile they were editing even if it were possible).
You could possibly work with post forms instead of user forms, creating and editing a dummy user profile post, and at the end of the process when they finally register you update fields from this profile post as required, though as they will not be the authors of their profile post (it having been completed and edited while the user is just a guest) you will also need some way to track how the post connects to the eventual user.
I would say that the most appropriate option would be a bespoke solution where you gather data about the user in your initial multi-step form stages and store it locally (in cookies or local storage), and then when you have them arrive at a registration form you submit that data at the same time to be handled in one final step.
For the first paragraph, I want to know if this is possible - Should I create a dummy user in step one (without email and by using autogenerate functionality) and then update that user in steps 2,3,4. After that, should I add the email address to the same user?
Second para - getting the right post would be an issue.
Third - will require more work and I am considering it.
Theoretically, we can change both on the database level, but that may create inconsistencies with WordPress's cache.
I would suggest to:
- Programmatically create a user to let the visitor go through the forms.
- Let the user complete the process steps.
- Then, create a new final user for the visitor, copy the posts or custom fields to it. Then, delete the old user.